net.sue445.kulib.util
Class CompressMemcacheUtil

java.lang.Object
  extended by net.sue445.kulib.util.CompressMemcacheUtil

public final class CompressMemcacheUtil
extends Object

put a compressed serialize object to Memcache
note: this util is not support hot reloading

Author:
sue445

Method Summary
static byte[] compress(byte[] src)
          compress binary
static
<T> T
deserialize(byte[] src)
          deserialize to object
static
<T> T
get(Object key)
          get a compressed object from Memcache
static void put(Object key, Object src)
          put a compressed object to Memcache
static void put(Object key, Object src, com.google.appengine.api.memcache.Expiration expiration)
          put a compressed object to Memcache
static byte[] serialize(Object src)
          serialize a object
static byte[] uncompress(byte[] src)
          uncompress binary
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

put

public static void put(Object key,
                       Object src)
put a compressed object to Memcache

Parameters:
key -
src -

put

public static void put(Object key,
                       Object src,
                       com.google.appengine.api.memcache.Expiration expiration)
put a compressed object to Memcache

Parameters:
key -
src -
expiration -

serialize

public static byte[] serialize(Object src)
                        throws IOException
serialize a object

Parameters:
src - a object
Returns:
serialized binary
Throws:
IOException

compress

public static byte[] compress(byte[] src)
                       throws IOException
compress binary

Parameters:
src - uncompressed binary
Returns:
compressed binary
Throws:
IOException

get

public static <T> T get(Object key)
get a compressed object from Memcache

Parameters:
key -
Returns:

uncompress

public static byte[] uncompress(byte[] src)
                         throws IOException
uncompress binary

Parameters:
src - compressed binary
Returns:
uncompressed binary
Throws:
IOException

deserialize

public static <T> T deserialize(byte[] src)
                     throws IOException,
                            ClassNotFoundException
deserialize to object

Parameters:
src - serialized binary
Returns:
deserialized object
Throws:
ClassNotFoundException
IOException


Copyright © 2013. All Rights Reserved.