Package javax.cache

Interface CacheWriter<K,V>

Type Parameters:
K - the type of keys maintained by this map
V - the type of mapped values

public interface CacheWriter<K,V>
A CacheWriter is used for write-through to an underlying resource.

The semantics of write-through when an Exception is thrown are implementation specific.

The transactional semantics of write-through on a transactional cache are implementation specific.

The entry passed into write(javax.cache.Cache.Entry) is independent of the cache mapping for that key meaning that if the value changes in the cache or is removed it does not change the said entry.

Since:
1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Delete the cache entry from the store
    void
    deleteAll(Collection<?> entries)
    Remove data and keys from the underlying store for the given collection of keys, if present.
    void
    write(Cache.Entry<K,V> entry)
    Write the specified value under the specified key to the underlying store.
    void
    writeAll(Collection<Cache.Entry<? extends K,? extends V>> entries)
    Write the specified entries to the underlying store.
  • Method Details

    • write

      void write(Cache.Entry<K,V> entry)
      Write the specified value under the specified key to the underlying store. This method is intended to support both key/value creation and value update for a specific key.
      Parameters:
      entry - the entry to be written
      Throws:
      CacheException - if ????? TODO describe when
    • writeAll

      void writeAll(Collection<Cache.Entry<? extends K,? extends V>> entries)
      Write the specified entries to the underlying store. This method is intended to support both insert and update. If this operation fails (by throwing an exception) after a partial success, the convention is that entries which have been written successfully are to be removed from the specified entries, indicating that the write operation for the entries left in the map has failed or has not been attempted.
      Parameters:
      entries - the entries to be written
      Throws:
      CacheException - if ????? TODO describe when
    • delete

      void delete(Object key)
      Delete the cache entry from the store
      Parameters:
      key - the key that is used for the delete operation
      Throws:
      CacheException - if ????? TODO describe when
    • deleteAll

      void deleteAll(Collection<?> entries)
      Remove data and keys from the underlying store for the given collection of keys, if present. If this operation fails (by throwing an exception) after a partial success, the convention is that keys which have been erased successfully are to be removed from the specified keys, indicating that the erase operation for the keys left in the collection has failed or has not been attempted.

      Expiry of a cache entry is not a delete hence will not cause this method to be invoked.

      Parameters:
      entries - the entries that have been removed from the cache
      Throws:
      CacheException - if ????? TODO describe when