class ClusteredStore implements TerracottaStore, StoreListener {

  @Override
  public boolean replace(Element old, Element element, ElementValueComparator comparator) throws NullPointerException,
      IllegalArgumentException {
    if (isEventual && !EVENTUAL_CAS_ENABLED) {
      throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a StronglyConsistentCacheAccessor");
    }

    String pKey = generatePortableKeyFor(element.getKey());
    ToolkitReadWriteLock lock = backend.createLockForKey(pKey);
    lock.writeLock().lock();
    try {
      Element oldElement = getQuiet(element.getKey());
      if (comparator.equals(oldElement, old)) { return putInternal(element); }
    } finally {
      lock.writeLock().unlock();
    }
    return false;
  }

  public  ClusteredStore(ToolkitInstanceFactory toolkitInstanceFactory, Ehcache cache, CacheCluster topology);

}