store method

void store(
  1. String url,
  2. CacheEntry entry, {
  3. Encoding encoding = utf8,
})

Implementation

void store(String url, CacheEntry entry, {Encoding encoding: utf8}) async {
  final int key = url.hashCode;

  if (useMemory) {
    _cache.set(url, entry).then((_) {
      stats.bytesInMemory += entry.length;
    });
  }

  File contentFile = File("$path/${key % 10}/$key");
  contentFile.create(recursive: true).then((_) {
    entry.writeTo(contentFile, encoding: encoding);

    stats.bytesInFile += entry.length;
  });
}