Skip to content

Commit

Permalink
Fixes #200.
Browse files Browse the repository at this point in the history
Fixes #201.

Stable Version 4.4.0
  • Loading branch information
jmdobry committed Oct 12, 2015
1 parent 70a5884 commit 84616a9
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 40 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
##### 4.4.0 12 October 2015

- #200 - 4.3 storagePrefix is not backwards compatible
- #201 - webpack minification error

##### 4.3.2 10 July 2015

- #191 - yabh issue with ie8
Expand Down
14 changes: 14 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,19 @@ module.exports = function (grunt) {
'test/**/*.js'
]
}
},
c9: {
browsers: ['PhantomJS'],
options: {
files: [
'bower_components/angular-1.2.25/angular.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-mocks-1.2.25/angular-mocks.js',
'dist/angular-cache.min.js',
'./karma.start.js',
'test/**/*.js'
]
}
}
},
coveralls: {
Expand All @@ -116,6 +129,7 @@ module.exports = function (grunt) {
});

grunt.registerTask('test', ['build', 'karma:dist', 'karma:min']);
grunt.registerTask('test_c9', ['build', 'karma:c9']);
grunt.registerTask('build', [
'clean',
'webpack',
Expand Down
45 changes: 25 additions & 20 deletions dist/angular-cache.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* angular-cache
* @version 4.3.2 - Homepage <http://jmdobry.github.io/angular-cache/>
* @version 4.4.0 - Homepage <http://jmdobry.github.io/angular-cache/>
* @author Jason Dobry <[email protected]>
* @copyright (c) 2013-2015 Jason Dobry
* @license MIT <https://github.com/jmdobry/angular-cache/blob/master/LICENSE>
Expand Down Expand Up @@ -84,6 +84,7 @@ return /******/ (function(modules) { // webpackBootstrap
_classCallCheck(this, CacheFactoryProvider);

this.defaults = CacheFactory.defaults;
this.defaults.storagePrefix = 'angular-cache.caches.';

this.$get = ['$q', function ($q) {
CacheFactory.utils.Promise = $q;
Expand All @@ -94,11 +95,13 @@ return /******/ (function(modules) { // webpackBootstrap
angular.module('angular-cache', []).provider('BinaryHeap', BinaryHeapProvider).provider('CacheFactory', CacheFactoryProvider);

module.exports = 'angular-cache';
module.exports.name = 'angular-cache';
try {
module.exports.name = 'angular-cache';
} catch (err) {}

/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
/***/ function(module, exports) {

module.exports = __WEBPACK_EXTERNAL_MODULE_1__;

Expand All @@ -108,7 +111,7 @@ return /******/ (function(modules) { // webpackBootstrap

/*!
* cachefactory
* @version 1.1.0 - Homepage <http://jmdobry.github.io/cachefactory/>
* @version 1.2.0 - Homepage <http://jmdobry.github.io/cachefactory/>
* @author Jason Dobry <[email protected]>
* @copyright (c) 2013-2015 Jason Dobry
* @license MIT <https://github.com/jmdobry/cachefactory/blob/master/LICENSE>
Expand All @@ -119,7 +122,7 @@ return /******/ (function(modules) { // webpackBootstrap
if(true)
module.exports = factory();
else if(typeof define === 'function' && define.amd)
define(factory);
define([], factory);
else if(typeof exports === 'object')
exports["CacheFactory"] = factory();
else
Expand Down Expand Up @@ -407,7 +410,7 @@ return /******/ (function(modules) { // webpackBootstrap
created: item.created,
accessed: item.accessed,
expires: item.expires,
isExpired: new Date().getTime() - item.created > this.$$maxAge
isExpired: new Date().getTime() - item.created > (item.maxAge || this.$$maxAge)
};
} else {
return undefined;
Expand All @@ -420,7 +423,7 @@ return /******/ (function(modules) { // webpackBootstrap
created: item.created,
accessed: item.accessed,
expires: item.expires,
isExpired: new Date().getTime() - item.created > this.$$maxAge
isExpired: new Date().getTime() - item.created > (item.maxAge || this.$$maxAge)
};
} else {
return undefined;
Expand Down Expand Up @@ -523,7 +526,11 @@ return /******/ (function(modules) { // webpackBootstrap
accessed: now
};

item.expires = item.created + this.$$maxAge;
if (options.maxAge) {
item.maxAge = options.maxAge;
}

item.expires = item.created + (item.maxAge || this.$$maxAge);

if ($$storage) {
if (_isPromiseLike(item.value)) {
Expand Down Expand Up @@ -759,7 +766,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.$$maxAge === Number.MAX_VALUE) {
item.expires = Number.MAX_VALUE;
} else {
item.expires = item.created + this.$$maxAge;
item.expires = item.created + (item.maxAge || this.$$maxAge);
}
$$expiresHeap.push({
key: key,
Expand All @@ -775,7 +782,7 @@ return /******/ (function(modules) { // webpackBootstrap
if (this.$$maxAge === Number.MAX_VALUE) {
$$data[key].expires = Number.MAX_VALUE;
} else {
$$data[key].expires = $$data[key].created + this.$$maxAge;
$$data[key].expires = $$data[key].created + ($$data[key].maxAge || this.$$maxAge);
}
$$expiresHeap.push($$data[key]);
}
Expand Down Expand Up @@ -905,18 +912,16 @@ return /******/ (function(modules) { // webpackBootstrap
var shouldReInsert = false;
var items = {};

if (typeof this.$$storageMode === 'string' && this.$$storageMode !== storageMode) {
var keys = this.keys();
var keys = this.keys();

if (keys.length) {
for (var i = 0; i < keys.length; i++) {
items[keys[i]] = this.get(keys[i]);
}
for (i = 0; i < keys.length; i++) {
this.remove(keys[i]);
}
shouldReInsert = true;
if (keys.length) {
for (var i = 0; i < keys.length; i++) {
items[keys[i]] = this.get(keys[i]);
}
for (i = 0; i < keys.length; i++) {
this.remove(keys[i]);
}
shouldReInsert = true;
}

this.$$storageMode = storageMode;
Expand Down
Loading

0 comments on commit 84616a9

Please sign in to comment.