Skip to content

Commit

Permalink
improved compression
Browse files Browse the repository at this point in the history
  • Loading branch information
root committed Nov 2, 2018
1 parent 066754a commit ccd53c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions dist/cache-api-keyval.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions src/cache-api-keyval.js
Expand Up @@ -40,8 +40,8 @@
}

// open cache storage
function CACHE_OPEN(store) {
return caches.open(store);
function CACHE_OPEN(store, callback) {
return caches.open(store).then(callback);
}

// return cache key
Expand All @@ -51,7 +51,7 @@

// get key from cache
function CACHE_GET(store, key) {
return CACHE_OPEN(store).then(function(cache) {
return CACHE_OPEN(store, function(cache) {

var cache_key = CACHE_KEY(key);

Expand All @@ -73,7 +73,7 @@

// set key in cache
function CACHE_SET(store, key, data, expire) {
return CACHE_OPEN(store).then(function(cache) {
return CACHE_OPEN(store, function(cache) {

var cache_key = CACHE_KEY(key);

Expand All @@ -82,8 +82,8 @@
// cache date
cache_headers[DATE_HEADER] = NOW();

// content type
if (typeof data === 'object') {
// JSON content type
if (IS_OBJECT(data)) {

// JSON
cache_headers[CONTENT_TYPE_HEADER] = CONTENT_TYPE_JSON;
Expand Down Expand Up @@ -129,15 +129,15 @@

// set key in cache
function CACHE_DELETE(store, key) {
return CACHE_OPEN(store).then(function(cache) {
return CACHE_OPEN(store, function(cache) {
var cache_key = CACHE_KEY(key);
return cache.delete(cache_key);
});
}

// set key in cache
function CACHE_PRUNE(store, key) {
return CACHE_OPEN(store).then(function(cache) {
return CACHE_OPEN(store, function(cache) {

// get all keys from store
return cache.keys().then(function(keys) {
Expand Down

0 comments on commit ccd53c0

Please sign in to comment.