Examples of CachedData


Examples of net.rubyeye.xmemcached.transcoders.CachedData

  @Override
  @SuppressWarnings("unchecked")
  protected CachedData encodeValue() {

    final CachedData value = this.transcoder.encode(this.value);
    // If disable save primitive type as string,prepend 4 bytes flag to
    // value
    if (!this.transcoder.isPrimitiveAsString()) {
      int flags = value.getFlag();
      byte[] flagBytes = KestrelGetCommand.transcoderUtils
          .encodeInt(flags);
      byte[] origData = value.getData();
      byte[] newData = new byte[origData.length + 4];
      System.arraycopy(flagBytes, 0, newData, 0, 4);
      System.arraycopy(origData, 0, newData, 4, origData.length);
      value.setCapacity(newData.length);
      value.setData(newData);
    }
    return value;
  }
View Full Code Here

Examples of net.spy.memcached.CachedData

        flags |= COMPRESSED;
      }else{
        getLogger().info("Compression increased the size of %s from %d to %d", Set.class, b.length, compressed.length);
      }
    }
    return new CachedData(flags, b, getMaxSize());
  }
View Full Code Here

Examples of net.spy.memcached.CachedData

      public void gotData(String k, int flags, long cas, byte[] data) {
        assert key.equals(k) : "Wrong key returned";
        assert cas > 0 : "CAS was less than zero:  " + cas;
        val =
            new CASValue<T>(cas, tc.decode(new CachedData(flags, data, tc
                .getMaxSize())));
      }

      public void complete() {
        latch.countDown();
View Full Code Here

Examples of net.spy.memcached.CachedData

          }

          @Override
          public void gotData(String k, int flags, byte[] data) {
            assert key.equals(k) : "Wrong key returned";
            val = tcService.decode(tc, new CachedData(flags, data,
              tc.getMaxSize()));
          }

          @Override
          public void complete() {
            latch.countDown();
          }
        });
    } else {
      return opFact.get(key, new GetOperation.Callback() {
        private Future<T> val = null;

        @Override
        public void receivedStatus(OperationStatus status) {
          future.set(val, status);
          if (!replicaFuture.isDone() && status.isSuccess()) {
            replicaFuture.setCompletedFuture(future);
          }
        }

        @Override
        public void gotData(String k, int flags, byte[] data) {
          assert key.equals(k) : "Wrong key returned";
          val = tcService.decode(tc, new CachedData(flags, data,
            tc.getMaxSize()));
        }

        @Override
        public void complete() {
View Full Code Here

Examples of net.spy.memcached.CachedData

      public void gotData(String k, int flags, long cas, byte[] data) {
        assert key.equals(k) : "Wrong key returned";
        assert cas > 0 : "CAS was less than zero:  " + cas;
        val =
            new CASValue<T>(cas, tc.decode(new CachedData(flags, data, tc
                .getMaxSize())));
      }

      public void complete() {
        latch.countDown();
View Full Code Here

Examples of net.spy.memcached.CachedData

          }

          @Override
          public void gotData(String k, int flags, byte[] data) {
            assert key.equals(k) : "Wrong key returned";
            val = tcService.decode(tc, new CachedData(flags, data,
              tc.getMaxSize()));
          }

          @Override
          public void complete() {
            latch.countDown();
            if (usedFuture) {
              replicaFuture.signalComplete();
            }
          }
        });
    } else {
      return opFact.get(key, new GetOperation.Callback() {
        private Future<T> val = null;
        private boolean usedFuture;

        @Override
        public void receivedStatus(OperationStatus status) {
          future.set(val, status);
          if (!replicaFuture.isDone() && status.isSuccess()) {
            usedFuture = replicaFuture.setCompletedFuture(future);
          }
        }

        @Override
        public void gotData(String k, int flags, byte[] data) {
          assert key.equals(k) : "Wrong key returned";
          val = tcService.decode(tc, new CachedData(flags, data,
            tc.getMaxSize()));
        }

        @Override
        public void complete() {
View Full Code Here

Examples of net.spy.memcached.CachedData

          }

          @Override
          public void gotData(String key, int flags, long cas, byte[] data) {
            assert key.equals(key) : "Wrong key returned";
            val = new CASValue<T>(cas, tc.decode(new CachedData(flags, data,
              tc.getMaxSize())));
          }

          @Override
          public void complete() {
            latch.countDown();
            if (usedFuture) {
              replicaFuture.signalComplete();
            }
          }
        });
    } else {
      return opFact.gets(key, new GetsOperation.Callback() {
        private CASValue<T> val = null;
        private boolean usedFuture;

        @Override
        public void receivedStatus(OperationStatus status) {
          future.set(val, status);
          if (!replicaFuture.isDone() && status.isSuccess()) {
            usedFuture = replicaFuture.setCompletedFuture(future);
          }
        }

        @Override
        public void gotData(String key, int flags, long cas, byte[] data) {
          assert key.equals(key) : "Wrong key returned";
          val = new CASValue<T>(cas, tc.decode(new CachedData(flags, data,
            tc.getMaxSize())));
        }

        @Override
        public void complete() {
View Full Code Here

Examples of net.spy.memcached.CachedData

      public void gotData(String k, int flags, long cas, byte[] data) {
        assert key.equals(k) : "Wrong key returned";
        assert cas > 0 : "CAS was less than zero:  " + cas;
        val =
            new CASValue<T>(cas, tc.decode(new CachedData(flags, data, tc
                .getMaxSize())));
      }

      public void complete() {
        latch.countDown();
View Full Code Here

Examples of net.spy.memcached.CachedData

          }

          @Override
          public void gotData(String k, int flags, byte[] data) {
            assert key.equals(k) : "Wrong key returned";
            val = tcService.decode(tc, new CachedData(flags, data,
              tc.getMaxSize()));
          }

          @Override
          public void complete() {
            latch.countDown();
            if (usedFuture) {
              replicaFuture.signalComplete();
            }
          }
        });
    } else {
      return opFact.get(key, new GetOperation.Callback() {
        private Future<T> val = null;
        private boolean usedFuture;

        @Override
        public void receivedStatus(OperationStatus status) {
          future.set(val, status);
          if (!replicaFuture.isDone() && status.isSuccess()) {
            usedFuture = replicaFuture.setCompletedFuture(future);
          }
        }

        @Override
        public void gotData(String k, int flags, byte[] data) {
          assert key.equals(k) : "Wrong key returned";
          val = tcService.decode(tc, new CachedData(flags, data,
            tc.getMaxSize()));
        }

        @Override
        public void complete() {
View Full Code Here

Examples of net.spy.memcached.CachedData

          }

          @Override
          public void gotData(String key, int flags, long cas, byte[] data) {
            assert key.equals(key) : "Wrong key returned";
            val = new CASValue<T>(cas, tc.decode(new CachedData(flags, data,
              tc.getMaxSize())));
          }

          @Override
          public void complete() {
            latch.countDown();
            if (usedFuture) {
              replicaFuture.signalComplete();
            }
          }
        });
    } else {
      return opFact.gets(key, new GetsOperation.Callback() {
        private CASValue<T> val = null;
        private boolean usedFuture;

        @Override
        public void receivedStatus(OperationStatus status) {
          future.set(val, status);
          if (!replicaFuture.isDone() && status.isSuccess()) {
            usedFuture = replicaFuture.setCompletedFuture(future);
          }
        }

        @Override
        public void gotData(String key, int flags, long cas, byte[] data) {
          assert key.equals(key) : "Wrong key returned";
          val = new CASValue<T>(cas, tc.decode(new CachedData(flags, data,
            tc.getMaxSize())));
        }

        @Override
        public void complete() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.