CloudDatastoreCache extends AbstractRemoteCache { @Override public void set(String key, byte[] value) { set(key, value, 0); }  @Override byte[] get(String key); @Override void set(String key, byte[] value); @Override void set(String key, byte[] value, int expireIn); @Override void delete(String key); int deleteExpiredItems(); int deleteExpiredItems(Integer limit); @Override Lock acquireLock(String lockName); @Override CheckResult checkConnection(); final static String CACHE_KIND; final static String CACHE_VALUE_FIELD; final static String CACHE_EXPIRY_FIELD; }
@Test public void testSet() { Datastore datastore = getService(); KeyFactory keyFactory = datastore.newKeyFactory().setKind(CACHE_KIND); Key datastoreKey = keyFactory.newKey("test"); Entity entity = datastore.get(datastoreKey); assertNull(entity); cache.set("test", "abcd".getBytes()); entity = datastore.get(datastoreKey); assertArrayEquals("abcd".getBytes(), entity.getBlob(CACHE_VALUE_FIELD).toByteArray()); }