Class NamespacedKeyValueStore

java.lang.Object
com.aquima.web.sessionmanager.NamespacedKeyValueStore
All Implemented Interfaces:
com.blueriq.component.api.store.keyvalue.IKeyValueStore

public class NamespacedKeyValueStore extends Object implements com.blueriq.component.api.store.keyvalue.IKeyValueStore
An IKeyValueStore wrapper which causes all keys to be namespaced by prefixing them with an specified namespace string followed by the the colon character.

For example, if the namespace is "example", then calling set("test", "value") will set the "example:test" key in the key-value store.

Since:
11.0
Author:
Petru Galanton
  • Constructor Details Link icon

    • NamespacedKeyValueStore Link icon

      public NamespacedKeyValueStore(com.blueriq.component.api.store.keyvalue.IKeyValueStore delegate, String namespace)
      Creates a new instance.
      Parameters:
      delegate - - the delegate IKeyValueStore implementation
      namespace - - the key namespace, must not be null
      Throws:
      IllegalArgumentException - if namespace is null
  • Method Details Link icon

    • set Link icon

      public void set(String key, Serializable value)
      Specified by:
      set in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • set Link icon

      public void set(String key, Serializable value, long timeout, TimeUnit unit)
      Specified by:
      set in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • setRaw Link icon

      public void setRaw(String key, byte[] value)
      Specified by:
      setRaw in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • setRaw Link icon

      public void setRaw(String key, byte[] value, long timeout, TimeUnit unit)
      Specified by:
      setRaw in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • get Link icon

      public <T extends Serializable> T get(String key, Class<T> valueType)
      Specified by:
      get in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • getRaw Link icon

      public byte[] getRaw(String key)
      Specified by:
      getRaw in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • delete Link icon

      public void delete(String key)
      Specified by:
      delete in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • deleteAll Link icon

      public void deleteAll(String... keys)
      Specified by:
      deleteAll in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • hasKey Link icon

      public boolean hasKey(String key)
      Specified by:
      hasKey in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • expire Link icon

      public boolean expire(String key, long timeout, TimeUnit unit)
      Specified by:
      expire in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • keyIterator Link icon

      public com.blueriq.component.api.store.keyvalue.IKeyValueStore.IKeyIterator keyIterator(com.blueriq.component.api.store.keyvalue.IKeyPattern pattern)
      Specified by:
      keyIterator in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • keys Link icon

      public Set<String> keys(com.blueriq.component.api.store.keyvalue.IKeyPattern pattern)
      Specified by:
      keys in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • getNamespaceSeparator Link icon

      public String getNamespaceSeparator()
      Specified by:
      getNamespaceSeparator in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • getKeyPatternBuilder Link icon

      public com.blueriq.component.api.store.keyvalue.IKeyPatternBuilder getKeyPatternBuilder()
      Specified by:
      getKeyPatternBuilder in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • serialize Link icon

      public byte[] serialize(Serializable value)
      Specified by:
      serialize in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • deserialize Link icon

      public <T> T deserialize(byte[] bytes, Class<T> valueType)
      Specified by:
      deserialize in interface com.blueriq.component.api.store.keyvalue.IKeyValueStore
    • getNamespacedKey Link icon

      public String getNamespacedKey(String key)
      Applies the namespace to the given key and returns the result.
      Parameters:
      key - the key that shold be namespaced
      Returns:
      the namespaced key