Class CacheImpl<K,​CE>

  • All Implemented Interfaces:
    Closeable, AutoCloseable, Iterable<javax.cache.Cache.Entry<K,​CacheEntry<CE>>>, javax.cache.Cache<K,​CacheEntry<CE>>

    public class CacheImpl<K,​CE>
    extends Object
    implements javax.cache.Cache<K,​CacheEntry<CE>>
    User: Stephan Bösebeck Date: 17.05.18 Time: 08:38

    simple copy before update implemenation of a in-Memory Cache

    • Constructor Detail

      • CacheImpl

        public CacheImpl()
    • Method Detail

      • setCacheManager

        public void setCacheManager​(javax.cache.CacheManager cm)
      • get

        public CacheEntry<CE> get​(K key)
        Specified by:
        get in interface javax.cache.Cache<K,​CE>
      • getAll

        public Map<K,​CacheEntry<CE>> getAll​(Set<? extends K> keys)
        Specified by:
        getAll in interface javax.cache.Cache<K,​CE>
      • containsKey

        public boolean containsKey​(K key)
        Specified by:
        containsKey in interface javax.cache.Cache<K,​CE>
      • loadAll

        public void loadAll​(Set<? extends K> keys,
                            boolean replaceExistingValues,
                            javax.cache.integration.CompletionListener completionListener)
        Specified by:
        loadAll in interface javax.cache.Cache<K,​CE>
      • put

        public void put​(K key,
                        CacheEntry<CE> value)
        Specified by:
        put in interface javax.cache.Cache<K,​CE>
      • getAndPut

        public CacheEntry<CE> getAndPut​(K key,
                                        CacheEntry<CE> value)
        Specified by:
        getAndPut in interface javax.cache.Cache<K,​CE>
      • putAll

        public void putAll​(Map<? extends K,​? extends CacheEntry<CE>> map)
        Specified by:
        putAll in interface javax.cache.Cache<K,​CE>
      • putIfAbsent

        public boolean putIfAbsent​(K key,
                                   CacheEntry<CE> value)
        Specified by:
        putIfAbsent in interface javax.cache.Cache<K,​CE>
      • remove

        public boolean remove​(K key)
        Specified by:
        remove in interface javax.cache.Cache<K,​CE>
      • remove

        public boolean remove​(K key,
                              CacheEntry<CE> oldValue)
        Specified by:
        remove in interface javax.cache.Cache<K,​CE>
      • getAndRemove

        public CacheEntry<CE> getAndRemove​(K key)
        Specified by:
        getAndRemove in interface javax.cache.Cache<K,​CE>
      • replace

        public boolean replace​(K key,
                               CacheEntry<CE> oldValue,
                               CacheEntry<CE> newValue)
        Specified by:
        replace in interface javax.cache.Cache<K,​CE>
      • replace

        public boolean replace​(K key,
                               CacheEntry<CE> value)
        Specified by:
        replace in interface javax.cache.Cache<K,​CE>
      • getAndReplace

        public CacheEntry<CE> getAndReplace​(K key,
                                            CacheEntry<CE> value)
        Specified by:
        getAndReplace in interface javax.cache.Cache<K,​CE>
      • removeAll

        public void removeAll​(Set<? extends K> keys)
        Specified by:
        removeAll in interface javax.cache.Cache<K,​CE>
      • removeAll

        public void removeAll()
        Specified by:
        removeAll in interface javax.cache.Cache<K,​CE>
      • clear

        public void clear()
        Specified by:
        clear in interface javax.cache.Cache<K,​CE>
      • getConfiguration

        public <C extends javax.cache.configuration.Configuration<K,​CacheEntry<CE>>> C getConfiguration​(Class<C> clazz)
        Specified by:
        getConfiguration in interface javax.cache.Cache<K,​CE>
      • invoke

        public <T> T invoke​(K key,
                            javax.cache.processor.EntryProcessor<K,​CacheEntry<CE>,​T> entryProcessor,
                            Object... arguments)
                     throws javax.cache.processor.EntryProcessorException
        Specified by:
        invoke in interface javax.cache.Cache<K,​CE>
        Throws:
        javax.cache.processor.EntryProcessorException
      • invokeAll

        public <T> Map<K,​javax.cache.processor.EntryProcessorResult<T>> invokeAll​(Set<? extends K> keys,
                                                                                        javax.cache.processor.EntryProcessor<K,​CacheEntry<CE>,​T> entryProcessor,
                                                                                        Object... arguments)
        Specified by:
        invokeAll in interface javax.cache.Cache<K,​CE>
      • getName

        public String getName()
        Specified by:
        getName in interface javax.cache.Cache<K,​CE>
      • setName

        public void setName​(String name)
      • getCacheManager

        public javax.cache.CacheManager getCacheManager()
        Specified by:
        getCacheManager in interface javax.cache.Cache<K,​CE>
      • close

        public void close()
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface javax.cache.Cache<K,​CE>
        Specified by:
        close in interface Closeable
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface javax.cache.Cache<K,​CE>
      • unwrap

        public <T> T unwrap​(Class<T> clazz)
        Specified by:
        unwrap in interface javax.cache.Cache<K,​CE>
      • registerCacheEntryListener

        public void registerCacheEntryListener​(javax.cache.configuration.CacheEntryListenerConfiguration<K,​CacheEntry<CE>> cacheEntryListenerConfiguration)
        Specified by:
        registerCacheEntryListener in interface javax.cache.Cache<K,​CE>
      • deregisterCacheEntryListener

        public void deregisterCacheEntryListener​(javax.cache.configuration.CacheEntryListenerConfiguration<K,​CacheEntry<CE>> cacheEntryListenerConfiguration)
        Specified by:
        deregisterCacheEntryListener in interface javax.cache.Cache<K,​CE>
      • getSize

        public int getSize()
      • expire

        public void expire​(Object k)