Class SimpleDirectoryPersistentCache
- java.lang.Object
-
- org.jivesoftware.smackx.caps.cache.SimpleDirectoryPersistentCache
-
- All Implemented Interfaces:
EntityCapsPersistentCache
public class SimpleDirectoryPersistentCache extends Object implements EntityCapsPersistentCache
Simple implementation of an EntityCapsPersistentCache that uses a directory to store the Caps information for every known node. Every node is represented by a file.
-
-
Constructor Summary
Constructors Constructor Description SimpleDirectoryPersistentCache(File cacheDir)
Creates a new SimpleDirectoryPersistentCache Object.SimpleDirectoryPersistentCache(File cacheDir, StringEncoder<String> filenameEncoder)
Creates a new SimpleDirectoryPersistentCache Object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDiscoverInfoByNodePersistent(String nodeVer, DiscoverInfo info)
Add an DiscoverInfo to the persistent Cache.void
emptyCache()
Empty the Cache.DiscoverInfo
lookup(String nodeVer)
Lookup DiscoverInfo by a Node string.
-
-
-
Constructor Detail
-
SimpleDirectoryPersistentCache
public SimpleDirectoryPersistentCache(File cacheDir)
Creates a new SimpleDirectoryPersistentCache Object. Make sure that the cacheDir exists and that it's an directory.Default filename encoder
Base32
, as this will work on all file systems, both case sensitive and case insensitive. It does however produce longer filenames.- Parameters:
cacheDir
- TODO javadoc me please
-
SimpleDirectoryPersistentCache
public SimpleDirectoryPersistentCache(File cacheDir, StringEncoder<String> filenameEncoder)
Creates a new SimpleDirectoryPersistentCache Object. Make sure that the cacheDir exists and that it's an directory. If your cacheDir is case insensitive then make sure to set the StringEncoder toBase32
(which is the default).- Parameters:
cacheDir
- The directory where the cache will be stored.filenameEncoder
- Encodes the node string into a filename.
-
-
Method Detail
-
addDiscoverInfoByNodePersistent
public void addDiscoverInfoByNodePersistent(String nodeVer, DiscoverInfo info)
Description copied from interface:EntityCapsPersistentCache
Add an DiscoverInfo to the persistent Cache.- Specified by:
addDiscoverInfoByNodePersistent
in interfaceEntityCapsPersistentCache
- Parameters:
nodeVer
- TODO javadoc me pleaseinfo
- TODO javadoc me please
-
lookup
public DiscoverInfo lookup(String nodeVer)
Description copied from interface:EntityCapsPersistentCache
Lookup DiscoverInfo by a Node string.- Specified by:
lookup
in interfaceEntityCapsPersistentCache
- Parameters:
nodeVer
- TODO javadoc me please- Returns:
- DiscoverInfo.
-
emptyCache
public void emptyCache()
Description copied from interface:EntityCapsPersistentCache
Empty the Cache.- Specified by:
emptyCache
in interfaceEntityCapsPersistentCache
-
-