Class FileSystemKeyValueStore

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T extends java.io.Serializable>
      T
      get​(java.lang.String key)
      获取键值对(未过期的)。
      protected java.lang.String getFileName​(java.lang.String key, int ttl)  
      <T extends java.io.Serializable>
      void
      put​(java.lang.String key, T value, int ttl)
      设置带ttl控制的键值对。
      void remove​(java.lang.String... keys)
      移除指定键值对。
      <T extends java.io.Serializable>
      void
      set​(java.lang.String key, T value)
      设置常驻键值对。如果键值对已存在,仅更改键值对值。
      void touch​(java.lang.String key, java.lang.Integer ttl)
      刷新键值对创建时间,以及更改ttl。注意,不保证这是一个原子操作。
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • put

        public <T extends java.io.Serializable> void put​(java.lang.String key,
                                                         T value,
                                                         int ttl)
        Description copied from interface: KeyValueStore
        设置带ttl控制的键值对。
        Specified by:
        put in interface KeyValueStore
        ttl - 必须大于等于0,0为常驻不过期。
      • set

        public <T extends java.io.Serializable> void set​(java.lang.String key,
                                                         T value)
        Description copied from interface: KeyValueStore
        设置常驻键值对。如果键值对已存在,仅更改键值对值。
        Specified by:
        set in interface KeyValueStore
      • get

        public <T extends java.io.Serializable> T get​(java.lang.String key)
        Description copied from interface: KeyValueStore
        获取键值对(未过期的)。
        Specified by:
        get in interface KeyValueStore
      • touch

        public void touch​(java.lang.String key,
                          java.lang.Integer ttl)
        Description copied from interface: KeyValueStore
        刷新键值对创建时间,以及更改ttl。注意,不保证这是一个原子操作。
        Specified by:
        touch in interface KeyValueStore
        Parameters:
        key - 键值
        ttl - 当不为null时,更改ttl。
      • remove

        public void remove​(java.lang.String... keys)
        Description copied from interface: KeyValueStore
        移除指定键值对。
        Specified by:
        remove in interface KeyValueStore
      • getFileName

        protected java.lang.String getFileName​(java.lang.String key,
                                               int ttl)