Index: ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js |
diff --git a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js |
index 9fc872f7a9b4baf44dcbf468ef4d0441d7956a3b..15f4693999b83e94fd74f92efe89d79f14d250c7 100644 |
--- a/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js |
+++ b/ui/file_manager/file_manager/foreground/js/metadata/metadata_cache_set.js |
@@ -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,19 +172,64 @@ 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. |
* @constructor |