dcache 0.1.0

  • README.md
  • Installing
  • Versions
  • 75

Dcache

Dcache is a simple library to implement application caching in dart inspired by gcache

Feature

  • Supports expirable Cache, LFU, LRU.
  • Support eviction
  • Automatically load cache if it doesn't exists. (Optional)
  • Async loading of expirate value

Example

Simple use case

import 'package:dcache/dcache.dart';

void main() {
  Cache c = new SimpleCache(storage: new SimpleStorage(size: 20));

    c.set("key", 42);
    print(c.get("key")); // 42
    print(c.containsKey("unknown_key")); // false
    print(c.get("unknown_key")); // nil
}

Loading function

import 'package:dcache/dcache.dart';

void main() {
  Cache c = new SimpleCache<int, int>(storage: new SimpleStorage(size: 20))
    ..loader = (key, oldValue) => key*10
  ;

    print(c.get(4)); // 40
    print(c.get(5)); // 50
    print(c.containsKey(6)); // false
}

Author

Kevin PLATEL

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dcache: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dcache/dcache.dart';
  
Version Uploaded Documentation Archive
0.1.0 Jul 26, 2018 Go to the documentation of dcache 0.1.0 Download dcache 0.1.0 archive
0.0.1 Mar 3, 2017 Go to the documentation of dcache 0.0.1 Download dcache 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
62
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Dec 5, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:dcache/dcache.dart.

Maintenance issues and suggestions

Maintain CHANGELOG.md. (-20 points)

Changelog entries help clients to follow the progress in your code.

Use analysis_options.yaml. (-10 points)

Rename old .analysis_options file to analysis_options.yaml.

Read more about the setup of analysis-options.yaml.

Maintain an example.

None of the files in your example/ directory matches a known example patterns. Common file name patterns include: main.dart, example.dart or you could also use dcache.dart. Packages with multiple examples should use example/readme.md.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=1.20.0 <3.0.0
meta ^1.1.6 1.1.6
Dev dependencies
test ^1.3.0