Interface LocalStorage<K,​V>

  • All Superinterfaces:
    ExpirableStorage<K,​V,​BiPredicate<K,​V>>, Storage<K,​V>

    public interface LocalStorage<K,​V>
    extends ExpirableStorage<K,​V,​BiPredicate<K,​V>>
    An ExpirableStorage to be used locally. When in a cluster, each node will have its local copy. Each stored value expires after some time, according to the LocalStorageType. The difference between this and Cache is that this local storage is used to store instances which can be reused between requests, even if not serializable. When Cyclos runs in a cluster, caches evicts are broadcasted for all nodes, while in LocalStorage there's no such concept. Also, caches are configured via cyclos.properties, while local storage only has the TTL in the type.
    • Method Detail

      • addRemoveListener

        void addRemoveListener​(BiConsumer<K,​V> listener)
        Adds a listener called whenever a value is removed
      • get

        V get​(K key,
              Callable<V> producer)
        Returns the value associated with the given key, or producing a new one if none exists.