Package net.spy.memcached.transcoders

Examples of net.spy.memcached.transcoders.SerializingTranscoder


  }

  @Override
  protected void setUp() throws Exception
  {
    SerializingTranscoder transcoder = new SerializingTranscoder(
        50 * 1024 * 1024 // 50 MB
    );
    // disable compression
    transcoder.setCompressionThreshold(Integer.MAX_VALUE);

    client = new MemcachedClient(
        new ConnectionFactoryBuilder().setProtocol(ConnectionFactoryBuilder.Protocol.BINARY)
                                      .setHashAlg(DefaultHashAlgorithm.FNV1A_64_HASH)
                                      .setLocatorType(ConnectionFactoryBuilder.Locator.CONSISTENT)
View Full Code Here


    }

    @Override
    public T get( String key )
    {
        Object value = client.get( prefix( key ), new SerializingTranscoder() );
        client.touch( prefix( key ), expiration );
        if( value == null )
        {
            return null;
        }
View Full Code Here

    @Override
    public T remove( String key )
    {
        String prefixedKey = prefix( key );
        Object old = client.get( prefixedKey, new SerializingTranscoder() );
        if( old != null )
        {
            client.delete( prefixedKey );
        }
        return valueType.cast( old );
View Full Code Here

    }

    @Override
    public void put( String key, T value )
    {
        client.set( prefix( key ), expiration, value, new SerializingTranscoder() );
    }
View Full Code Here

                return new MemcachedClient(getMemcachedNodes());
            }

            @Provides
            public CASMutator createCASMutator(MemcachedClient memcachedClient) {
                return new CASMutator(memcachedClient, new SerializingTranscoder());
            }


        });
    }
View Full Code Here

        return uniqueInstance;

    }

    private MemcachedImpl() throws IOException {
        tc = new SerializingTranscoder() {

            @Override
            protected Object deserialize(byte[] data) {
                try {
                    return new ObjectInputStream(new ByteArrayInputStream(data)) {
View Full Code Here

                              final NinjaProperties ninjaProperties) throws Exception {
       
        this.logger = logger;
        this.ninjaProperties = ninjaProperties;
       
        this.tc = new SerializingTranscoder() {

            @Override
            protected Object deserialize(byte[] data) {
                try {
                    return new ObjectInputStream(new ByteArrayInputStream(data)) {
View Full Code Here

  /* (non-Javadoc)
   * @see net.spy.memcached.ConnectionFactory#getDefaultTranscoder()
   */
  public Transcoder<Object> getDefaultTranscoder() {
    return new SerializingTranscoder();
  }
View Full Code Here

   * (non-Javadoc)
   *
   * @see net.spy.memcached.ConnectionFactory#getDefaultTranscoder()
   */
  public Transcoder<Object> getDefaultTranscoder() {
    return new SerializingTranscoder();
  }
View Full Code Here

  /**
   * Attempt to get the object represented by the given serialized bytes.
   */
  private Object deserialize() {
    SerializingTranscoder tc = new SerializingTranscoder();
    CachedData d = new CachedData(this.getItemFlags(), this.getValue(),
      CachedData.MAX_SIZE);
    Object rv = null;
    rv = tc.decode(d);
    return rv;
  }
View Full Code Here

TOP

Related Classes of net.spy.memcached.transcoders.SerializingTranscoder

Copyright © 2018 www.massapicom. 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.