Class BaseCacheMap<V>

  • Type Parameters:
    V - the type of value taken and returned by this Map's underlying transcoder, and thus taken and returned by this Map.
    All Implemented Interfaces:
    java.util.Map<java.lang.String,​V>
    Direct Known Subclasses:
    CacheMap

    public class BaseCacheMap<V>
    extends java.lang.Object
    implements java.util.Map<java.lang.String,​V>
    Base class for a Map interface to memcached.

    This Map interface makes memcached a bit easier to use for some purposes by providing a limited Map implementation.

    Do note that nothing that iterates over the map will work (such is memcached). All iteration mechanisms will return empty iterators and such.

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean containsKey​(java.lang.Object key)  
      boolean containsValue​(java.lang.Object value)
      This method always returns false, as truth cannot be determined without iteration.
      java.util.Set<java.util.Map.Entry<java.lang.String,​V>> entrySet()  
      V get​(java.lang.Object key)  
      private java.lang.String getKey​(java.lang.String k)  
      boolean isEmpty()  
      java.util.Set<java.lang.String> keySet()  
      V put​(java.lang.String key, V value)  
      void putAll​(java.util.Map<? extends java.lang.String,​? extends V> t)  
      V remove​(java.lang.Object key)  
      int size()  
      java.util.Collection<V> values()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Map

        compute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAll
    • Field Detail

      • keyPrefix

        private final java.lang.String keyPrefix
      • exp

        private final int exp
    • Constructor Detail

      • BaseCacheMap

        public BaseCacheMap​(MemcachedClientIF c,
                            int expiration,
                            java.lang.String prefix,
                            Transcoder<V> t)
        Build a BaseCacheMap.
        Parameters:
        c - the underlying client
        expiration - the expiration for objects set through this Map
        prefix - a prefix to ensure objects in this map are unique
        t - the transcoder to serialize and deserialize objects
    • Method Detail

      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Map<java.lang.String,​V>
      • getKey

        private java.lang.String getKey​(java.lang.String k)
      • containsKey

        public boolean containsKey​(java.lang.Object key)
        Specified by:
        containsKey in interface java.util.Map<java.lang.String,​V>
      • containsValue

        public boolean containsValue​(java.lang.Object value)
        This method always returns false, as truth cannot be determined without iteration.
        Specified by:
        containsValue in interface java.util.Map<java.lang.String,​V>
      • entrySet

        public java.util.Set<java.util.Map.Entry<java.lang.String,​V>> entrySet()
        Specified by:
        entrySet in interface java.util.Map<java.lang.String,​V>
      • get

        public V get​(java.lang.Object key)
        Specified by:
        get in interface java.util.Map<java.lang.String,​V>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Map<java.lang.String,​V>
      • keySet

        public java.util.Set<java.lang.String> keySet()
        Specified by:
        keySet in interface java.util.Map<java.lang.String,​V>
      • putAll

        public void putAll​(java.util.Map<? extends java.lang.String,​? extends V> t)
        Specified by:
        putAll in interface java.util.Map<java.lang.String,​V>
      • remove

        public V remove​(java.lang.Object key)
        Specified by:
        remove in interface java.util.Map<java.lang.String,​V>
      • size

        public int size()
        Specified by:
        size in interface java.util.Map<java.lang.String,​V>
      • values

        public java.util.Collection<V> values()
        Specified by:
        values in interface java.util.Map<java.lang.String,​V>
      • put

        public V put​(java.lang.String key,
                     V value)
        Specified by:
        put in interface java.util.Map<java.lang.String,​V>