Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 var Cache = function() | |
|
lushnikov
2016/07/22 02:56:21
inline this all into protocol_files_proxy.js
chenwilliam
2016/07/22 17:35:25
Done.
| |
| 2 { | |
| 3 this._data = new Map(); | |
| 4 this._version = null; | |
| 5 }; | |
| 6 | |
| 7 Cache.prototype = { | |
| 8 | |
| 9 setVersion: function(version) | |
| 10 { | |
| 11 this._version = version; | |
| 12 }, | |
| 13 | |
| 14 hasFile: function(file) | |
| 15 { | |
| 16 return this._data.has(this._getKey(file)); | |
| 17 }, | |
| 18 | |
| 19 getFile: function(file) | |
| 20 { | |
| 21 return this._data.get(this._getKey(file)); | |
| 22 }, | |
| 23 | |
| 24 cacheFile: function(file, data) | |
| 25 { | |
| 26 this._data.set(this._getKey(file), data); | |
| 27 }, | |
| 28 | |
| 29 _getKey: function(file) | |
| 30 { | |
| 31 return `${file}__version:${this._version}`; | |
| 32 } | |
| 33 }; | |
| 34 | |
| 35 module.exports = Cache; | |
| OLD | NEW |