Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.octo.android.robospice.persistence;
 
This interface is mainly used for mocking/testing. Developpers should use directly the class CacheManager and should not have to implement this interface. Defines the behavior of a cache manager, a bus of ObjectPersister.

Author(s):
sni
public interface ICacheManager {
    public abstract void addObjectPersisterFactoryObjectPersisterFactory factory );
    public abstract void removeObjectPersisterFactoryObjectPersisterFactory factory );

    
Loads an instance of a class clazz, that is stored in cache under the key cacheKey.

Parameters:
clazz the class of the object that is supposed to be stored in cache.
cacheKey the key used to identify this item in cache.
maxTimeInCacheBeforeExpiry the maximum time (in ms) an item can be stored in cache before being considered expired.
Returns:
an instance of a class clazz, that is stored in cache under the key cacheKey. If the item is not found in cache or is older than maxTimeInCacheBeforeExpiry, then this method will return null.
Throws:
com.octo.android.robospice.exception.CacheLoadingException if an error occurs during cache reading, or instance creation.
    public abstract < T > T loadDataFromCacheClass< T > clazzObject cacheKeylong maxTimeInCacheBeforeExpiry ) throws CacheLoadingException;

    
Save an instance of a given class, into the cache identified by cacheKey. Some ObjectPersister can modify the data they receive before saving it. Most ObjectPersister instances will just save the data as-is, in this case, they can even return it and save it asynchronously in a background thread for a better efficiency.

Parameters:
data the data to be saved in cache.
cacheKey the key used to identify this item in cache.
Returns:
the data that was saved.
Throws:
com.octo.android.robospice.exception.CacheSavingException if an error occurs during cache writing.
    public abstract < T > T saveDataToCacheAndReturnData( T dataObject cacheKey ) throws CacheSavingException;

    
Removes a given data in the cache that is an instance of class clazz.

Parameters:
clazz the class of the data to be removed.
cacheKey the identifier of the data to be removed from cache.
Returns:
a boolean indicating whether or not this data could be removed.
    public abstract boolean removeDataFromCacheClass< ? > clazzObject cacheKey );

    
Removes all data in the cache that are instances of class clazz.

Parameters:
clazz the class of the data to be removed.
    public abstract void removeAllDataFromCacheClass< ? > clazz );

    
Removes all data in the cache.
    public abstract void removeAllDataFromCache();
New to GrepCode? Check out our FAQ X