Commit a07a6c2b authored by Ivan Tyagov's avatar Ivan Tyagov

We should have a way to 'purge' localStorage by setting a ROOT_CACHE_ID (which...

We should have a way to 'purge' localStorage by setting a ROOT_CACHE_ID (which can be changed server side)
parent 9906049b
......@@ -12,7 +12,7 @@
</item>
<item>
<key> <string>_EtagSupport__etag</string> </key>
<value> <string>ts34237877.11</string> </value>
<value> <string>ts34651695.58</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
......@@ -75,6 +75,16 @@ var LocalStorageCachePlugin = {\n
}\n
\n
var Cache = {\n
\n
ROOT_CACHE_ID: \'APP_CACHE\',\n
\n
getCacheId: function(cache_id) {\n
/* We should have a way to \'purge\' localStorage by setting a ROOT_CACHE_ID in all browser\n
* instances\n
*/\n
return Cache.ROOT_CACHE_ID + cache_id; \n
\n
},\n
\n
hasLocalStorage: function() {\n
/*\n
......@@ -91,6 +101,7 @@ var Cache = {\n
\n
get: function(cache_id, default_value){\n
/* Get cache key value */\n
cache_id = Cache.getCacheId(cache_id);\n
if (Cache.hasLocalStorage()){\n
return LocalStorageCachePlugin.get(cache_id, default_value);}\n
else{\n
......@@ -99,6 +110,7 @@ var Cache = {\n
\n
set: function(cache_id, data){\n
/* Set cache key value */\n
cache_id = Cache.getCacheId(cache_id);\n
if (Cache.hasLocalStorage()){\n
LocalStorageCachePlugin.set(cache_id, data);}\n
else{\n
......@@ -541,7 +553,7 @@ var RenderJs = {\n
</item>
<item>
<key> <string>size</string> </key>
<value> <int>18986</int> </value>
<value> <int>19314</int> </value>
</item>
<item>
<key> <string>title</string> </key>
......
4
\ No newline at end of file
5
\ No newline at end of file
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