Commit f2bf2b08 authored by Daichi Hirono's avatar Daichi Hirono

Files.app: Add MetadataCacheSetStorage implementation for LRUCache.

BUG=410766
TEST=None
R=yawano@chromium.org

Review URL: https://codereview.chromium.org/895723003

Cr-Commit-Position: refs/heads/master@{#314271}
parent 322fd48b
......@@ -134,7 +134,6 @@ MetadataCacheSet.prototype.hasFreshCache = function(entries, names) {
/**
* Interface of raw strage for MetadataCacheItem.
* TODO(hirono): Add implementation of the interface for LRUCache.
* @interface
*/
function MetadataCacheSetStorage() {
......@@ -173,18 +172,63 @@ function MetadataCacheSetStorageForObject(items) {
this.items_ = items;
}
/**
* @override
*/
MetadataCacheSetStorageForObject.prototype.get = function(url) {
return this.items_[url];
};
/**
* @override
*/
MetadataCacheSetStorageForObject.prototype.peek = function(url) {
return this.items_[url];
};
/**
* @override
*/
MetadataCacheSetStorageForObject.prototype.put = function(url, item) {
this.items_[url] = item;
};
/**
* Implementation of MetadataCacheSetStorage by using LRUCache.
* @param {!LRUCache<!MetadataCacheItem>} cache LRUCache.
* @constructor
* @implements {MetadataCacheSetStorage}
* @struct
*/
function MetadataCacheSetStorageForLRUCache(cache) {
/**
* @private {!LRUCache<!MetadataCacheItem>}
* @const
*/
this.cache_ = cache;
}
/**
* @override
*/
MetadataCacheSetStorageForLRUCache.prototype.get = function(url) {
return this.cache_.get(url);
};
/**
* @override
*/
MetadataCacheSetStorageForLRUCache.prototype.peek = function(url) {
return this.cache_.peek(url);
};
/**
* @override
*/
MetadataCacheSetStorageForLRUCache.prototype.put = function(url, item) {
this.cache_.put(url, item);
};
/**
* @param {!FileEntry} entry Entry
* @param {!Array<string>} names Property name list to be requested.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment