use of com.bluenimble.platform.cache.impls.memcached.MemCachedCache in project serverless by bluenimble.
the class MemCachedPlugin method init.
@Override
public void init(final ApiServer server) throws Exception {
Feature aFeature = Cache.class.getAnnotation(Feature.class);
if (aFeature == null || Lang.isNullOrEmpty(aFeature.name())) {
return;
}
feature = aFeature.name();
server.addFeature(new ServerFeature() {
private static final long serialVersionUID = 3585173809402444745L;
@Override
public Class<?> type() {
return Cache.class;
}
@Override
public Object get(ApiSpace space, String name) {
return new MemCachedCache(((RecyclableCacheClient) (space.getRecyclable(createKey(name)))).client());
}
@Override
public String provider() {
return MemCachedPlugin.this.getName();
}
@Override
public Plugin implementor() {
return MemCachedPlugin.this;
}
});
}
Aggregations