JsonCacheInfoRepository class
- Inheritance
-
- Object
- CacheInfoRepository
- JsonCacheInfoRepository
- Available extensions
Constructors
- JsonCacheInfoRepository({String? path, String? databaseName})
- Either the path or the database name should be provided. If the path is provider it should end with '{databaseName}.json', for example: /data/user/0/com.example.example/databases/imageCache.json
- JsonCacheInfoRepository.withFile(File file)
- The directory and the databaseName should both the provided. The database is stored as {databaseName}.json in the directory,
Properties
- databaseName ↔ String?
-
getter/setter pair
- directory ↔ Directory?
-
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
-
openCompleter
↔ Completer<
bool> ? -
getter/setter pairinherited
- openConnections ↔ int
-
getter/setter pairinherited
- path ↔ String?
-
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timer ↔ Timer?
-
getter/setter pair
- timerDuration ↔ Duration
-
getter/setter pair
Methods
-
close(
) → Future< bool> -
Close the connection to the repository. If this is the last connection
to the repository it will return true and the repository is truly
closed. If there are still open connections it will return false;
override
-
delete(
int id) → Future< int> -
Deletes a cache object by
id
override -
deleteAll(
Iterable< int> ids) → Future<int> -
Deletes items with
ids
from the repositoryoverride -
deleteDataFile(
) → Future< void> -
Deletes the cache data file including all cache data.
override
-
exists(
) → Future< bool> -
Returns whether or not there is an existing data file with cache info.
override
-
get(
String key) → Future< CacheObject?> -
Gets a CacheObject by
key
override -
getAllObjects(
) → Future< List< CacheObject> > -
Gets the list of all objects in the cache
override
-
getObjectsOverCapacity(
int capacity) → Future< List< CacheObject> > -
Gets the list of CacheObject that can be removed if the repository is over capacity.
override
-
getOldObjects(
Duration maxAge) → Future< List< CacheObject> > -
Returns a list of CacheObject that are older than
maxAge
override -
insert(
CacheObject cacheObject, {bool setTouchedToNow = true}) → Future< CacheObject> -
Inserts
cacheObject
into the repositoryoverride -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
open(
) → Future< bool> -
Opens the repository, or just returns true if the repo is already open.
override
-
opened(
) → bool -
inherited
-
shouldClose(
) → bool -
inherited
-
shouldOpenOnNewConnection(
) → bool -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
update(
CacheObject cacheObject, {bool setTouchedToNow = true}) → Future< int> -
Updates an existing
cacheObject
override -
updateOrInsert(
CacheObject cacheObject) → Future -
Updates a given CacheObject, if it exists, or adds a new item to the repository
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited