@Test public void put_with_no_expiration() { MemcachedClient client = mock(MemcachedClient.class); MemcachedResponseStore store = new MemcachedResponseStore(client, "", false); store.put("key", response(null)); verifyNoMoreInteractions(client); }
@Override public void put(String key, CachedResponse response) { checkNotNull(key); checkArgument(key.length() > 0, "key can not be empty"); checkNotNull(response); if (!_readOnly) { DateTime expires = response.getExpires().orNull(); if (expires != null) { _client.set(buildKey(key), (int) (expires.getMillis() / 1000), response, CachedResponseTranscoder.INSTANCE); } } }
MemcachedResponseStore extends ResponseStore { @Override public void put(String key, CachedResponse response) { checkNotNull(key); checkArgument(key.length() > 0, "key can not be empty"); checkNotNull(response); if (!_readOnly) { DateTime expires = response.getExpires().orNull(); if (expires != null) { _client.set(buildKey(key), (int) (expires.getMillis() / 1000), response, CachedResponseTranscoder.INSTANCE); } } } }
MemcachedResponseStore extends ResponseStore { @Override public void put(String key, CachedResponse response) { checkNotNull(key); checkArgument(key.length() > 0, "key can not be empty"); checkNotNull(response); if (!_readOnly) { DateTime expires = response.getExpires().orNull(); if (expires != null) { _client.set(buildKey(key), (int) (expires.getMillis() / 1000), response, CachedResponseTranscoder.INSTANCE); } } } MemcachedResponseStore(MemcachedClient client, String keyPrefix, boolean readOnly); }
MemcachedResponseStore extends ResponseStore { @Override public void put(String key, CachedResponse response) { checkNotNull(key); checkArgument(key.length() > 0, "key can not be empty"); checkNotNull(response); if (!_readOnly) { DateTime expires = response.getExpires().orNull(); if (expires != null) { _client.set(buildKey(key), (int) (expires.getMillis() / 1000), response, CachedResponseTranscoder.INSTANCE); } } } MemcachedResponseStore(MemcachedClient client, String keyPrefix, boolean readOnly); @Override Optional<CachedResponse> get(String key); @Override void put(String key, CachedResponse response); @Override void invalidate(String key); }
MemcachedResponseStore extends ResponseStore { @Override public void put(String key, CachedResponse response) { checkNotNull(key); checkArgument(key.length() > 0, "key can not be empty"); checkNotNull(response); if (!_readOnly) { DateTime expires = response.getExpires().orNull(); if (expires != null) { _client.set(buildKey(key), (int) (expires.getMillis() / 1000), response, CachedResponseTranscoder.INSTANCE); } } } MemcachedResponseStore(MemcachedClient client, String keyPrefix, boolean readOnly); @Override Optional<CachedResponse> get(String key); @Override void put(String key, CachedResponse response); @Override void invalidate(String key);  }