net.sue445.kulib.dao
Class MemcacheProxyDaoBase<M extends Slim3Model>

java.lang.Object
  extended by net.sue445.kulib.dao.MemcacheProxyDaoBase<M>
Type Parameters:
M - ModelClass

public abstract class MemcacheProxyDaoBase<M extends Slim3Model>
extends Object

Datasrore access proxy dao with Memcache

Author:
sue445

Field Summary
protected static Logger logger
           
protected  ModelMeta<M> m
          The meta data of model.
protected  Class<M> modelClass
          The model class.
 
Constructor Summary
MemcacheProxyDaoBase()
          Constructor.
 
Method Summary
protected  String createMemcacheKey(Key key)
           
protected  List<String> createMemcacheKeys(Iterable<Key> keys)
           
 void delete(Key key)
          delete model in both Datastote and Memcache
 void deleteAll(Iterable<Key> keys)
          delete models in both Datastote and Memcache
protected  void deleteAllInMemcache(Iterable<Key> keys)
           
protected  void deleteInMemcache(Key key)
           
 M get(Key key)
          get model from Memcache or Datastore.
if not found in Memcache, get from Datastore and put to Memcache.
 List<M> getAll(Iterable<Key> keys)
          get models from Memcache or Datastore.
if not found in Memcache, get from Datastore and put to Memcache.
protected  Map<String,M> getAllFromMemcache(Iterable<Key> keys)
           
protected  M getFromMemcache(Key key)
           
 void put(M model)
          put model and clear Memcache
 void putAll(Iterable<M> models)
          put models and clear Memcache
protected  void putAllToMemcache(Iterable<M> models)
           
protected  void putToMemcache(M model)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final Logger logger

modelClass

protected Class<M extends Slim3Model> modelClass
The model class.


m

protected ModelMeta<M extends Slim3Model> m
The meta data of model.

Constructor Detail

MemcacheProxyDaoBase

public MemcacheProxyDaoBase()
Constructor.

Method Detail

put

public void put(M model)
put model and clear Memcache

Parameters:
model -

putAll

public void putAll(Iterable<M> models)
put models and clear Memcache

Parameters:
models -

createMemcacheKey

protected String createMemcacheKey(Key key)
Parameters:
key -
Returns:

createMemcacheKeys

protected List<String> createMemcacheKeys(Iterable<Key> keys)
Parameters:
keys -
Returns:

deleteInMemcache

protected void deleteInMemcache(Key key)
Parameters:
key -

deleteAllInMemcache

protected void deleteAllInMemcache(Iterable<Key> keys)
Parameters:
keys -

get

public M get(Key key)
get model from Memcache or Datastore.
if not found in Memcache, get from Datastore and put to Memcache.

Parameters:
key -
Returns:

getFromMemcache

protected M getFromMemcache(Key key)
Parameters:
key -
Returns:

putToMemcache

protected void putToMemcache(M model)
Parameters:
model -

putAllToMemcache

protected void putAllToMemcache(Iterable<M> models)
Parameters:
models -

getAll

public List<M> getAll(Iterable<Key> keys)
get models from Memcache or Datastore.
if not found in Memcache, get from Datastore and put to Memcache.

Parameters:
keys -
Returns:

getAllFromMemcache

protected Map<String,M> getAllFromMemcache(Iterable<Key> keys)
Parameters:
keys -
Returns:

delete

public void delete(Key key)
delete model in both Datastote and Memcache

Parameters:
key -

deleteAll

public void deleteAll(Iterable<Key> keys)
delete models in both Datastote and Memcache

Parameters:
key -


Copyright © 2013. All Rights Reserved.