コード例 #1
0
 @Override
 public boolean remove(final String key, final String value) throws CacheAccessException {
   this.checkFailingKey(key);
   final ValueHolder<String> currentValue = this.entries.get(key);
   if (currentValue == null || !currentValue.value().equals(value)) {
     return false;
   }
   this.entries.remove(key);
   return true;
 }
コード例 #2
0
 @Override
 public boolean replace(final String key, final String oldValue, final String newValue)
     throws CacheAccessException {
   this.checkFailingKey(key);
   final ValueHolder<String> currentValue = this.entries.get(key);
   if (currentValue != null && currentValue.value().equals(oldValue)) {
     this.entries.put(key, new FakeValueHolder(newValue));
     return true;
   }
   return false;
 }