org.codeforamerica.open311.internals.caching
Class AndroidCache
java.lang.Object
org.codeforamerica.open311.internals.caching.AbstractCache
org.codeforamerica.open311.internals.caching.AndroidCache
- All Implemented Interfaces:
- Cache
public class AndroidCache
- extends AbstractCache
Uses the SharedPreferences of Android to store the data. Singleton class.
- Author:
- Santiago MunĂn
Fields inherited from class org.codeforamerica.open311.internals.caching.AbstractCache |
FILE |
Methods inherited from class org.codeforamerica.open311.internals.caching.AbstractCache |
retrieveCachedServiceDefinition, retrieveCachedServiceDiscoveryInfo, retrieveCachedServiceList, retrieveCachedServiceRequest, retrieveCachedServiceRequests, retrieveCitiesInfo, saveCitiesInfo, saveListOfServices, saveServiceDefinition, saveServiceDiscovery, saveServiceRequestList, saveSingleServiceRequest, setCustomTimeToLive |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
getInstance
public static AndroidCache getInstance(android.content.Context context)
- Returns the unique instance of the class.
- Parameters:
context
- Android context. Needed the first time is called to build the
SharedPreferences
.
- Returns:
- Unique instance of the class.
deleteCache
public void deleteCache()
- Description copied from interface:
Cache
- Deletes the cache.
saveProperty
protected void saveProperty(String key,
String value)
- Description copied from class:
AbstractCache
- Saves a property. The given parameters must be valid strings with content
(empty or
null
strings are not allowed).
- Specified by:
saveProperty
in class AbstractCache
- Parameters:
key
- Key of the property.value
- Value of the property.
getProperty
protected String getProperty(String key)
- Description copied from class:
AbstractCache
- Retrieves a property.
- Specified by:
getProperty
in class AbstractCache
- Parameters:
key
- Key of the property (empty or null
strings are
not allowed).
- Returns:
- The property value of
null
if the key doesn't exist.
Copyright © 2013 Code for America. All Rights Reserved.