RMDatabaseCache Class Reference
Inherits from | NSObject |
Conforms to | RMTileCache |
Declared in | RMDatabaseCache.h |
Overview
An RMDatabaseCache object represents disk-based caching of map tile images. This cache is meant for longer-term storage than RMMemoryCache, potentially for long periods of time, allowing completely offline use of map view.
Warning: The database cache is currently based on SQLite, a lightweight, cross-platform, file-based relational database system. The schema is independent of and unrelated to the MBTiles file format or the RMMBTilesSource tile source.
Tasks
Getting the Database Path
-
databasePath
property
Initializing Database Caches
Configuring Cache Behavior
Properties
Instance Methods
fileSize
The current file size of the database cache on disk.
- (unsigned long long)fileSize
Discussion
The current file size of the database cache on disk.
Declared In
RMDatabaseCache.h
initUsingCacheDir:
Initializes and returns a newly allocated database cache object.
- (id)initUsingCacheDir:(BOOL)useCacheDir
Parameters
- useCacheDir
If YES, use the temporary cache space for the application, meaning that the cache files can be removed when the system deems it necessary to free up space. If NO, use the application’s document storage space, meaning that the cache will not be automatically removed and will be backed up during device backups. The default value is NO.
Return Value
An initialized cache object or nil
if the object couldn’t be created.
Discussion
Initializes and returns a newly allocated database cache object.
Declared In
RMDatabaseCache.h
initWithDatabase:
Initializes and returns a newly allocated database cache object at the given disk path.
- (id)initWithDatabase:(NSString *)path
Parameters
- path
The path to use for the database backing.
Return Value
An initialized cache object or nil
if the object couldn’t be created.
Discussion
Initializes and returns a newly allocated database cache object at the given disk path.
Declared In
RMDatabaseCache.h
setCapacity:
Set the maximum tile count allowed in the database.
- (void)setCapacity:(NSUInteger)theCapacity
Parameters
- theCapacity
The number of tiles to allow to accumulate in the database before purging begins.
Discussion
Set the maximum tile count allowed in the database.
Declared In
RMDatabaseCache.h
setExpiryPeriod:
Set the expiry period for cache purging.
- (void)setExpiryPeriod:(NSTimeInterval)theExpiryPeriod
Parameters
- theExpiryPeriod
The amount of time to elapse before a tile should be removed from the cache. If set to zero, tile count-based purging will be used instead of time-based.
Discussion
Set the expiry period for cache purging.
Declared In
RMDatabaseCache.h
setMinimalPurge:
Set the minimum number of tiles to purge when clearing space in the cache.
- (void)setMinimalPurge:(NSUInteger)thePurgeMinimum
Parameters
- thePurgeMinimum
The number of tiles to delete at the time the cache is purged.
Discussion
Set the minimum number of tiles to purge when clearing space in the cache.
Declared In
RMDatabaseCache.h