Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deps): upgrade to cachefactory 3.0.0 #258

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ app.service('myService', function (CacheFactory) {

// Check to make sure the cache doesn't already exist
if (!CacheFactory.get('profileCache')) {
profileCache = CacheFactory('profileCache');
profileCache = CacheFactory.createCache('profileCache');
}
});
```
Expand All @@ -109,15 +109,15 @@ Right now, these items will stay in the cache until a page refresh.
Let's have items which are added to `profileCache` expire after an hour:

```js
profileCache = CacheFactory('profileCache', {
profileCache = CacheFactory.createCache('profileCache', {
maxAge: 60 * 60 * 1000 // 1 hour
});
```

Perfect. Say we also want the items removed from the cache when they expire:

```js
profileCache = CacheFactory('profileCache', {
profileCache = CacheFactory.createCache('profileCache', {
maxAge: 60 * 60 * 1000, // 1 hour
deleteOnExpire: 'aggressive'
});
Expand All @@ -126,7 +126,7 @@ profileCache = CacheFactory('profileCache', {
Let's say that when the items do expire, we want to refresh them with new values:

```js
profileCache = CacheFactory('profileCache', {
profileCache = CacheFactory.createCache('profileCache', {
maxAge: 60 * 60 * 1000, // 1 hour
deleteOnExpire: 'aggressive',
onExpire: function (key, value) {
Expand Down Expand Up @@ -223,9 +223,9 @@ Possible values:
- `passive` - Cache will do nothing when an item expires. Expired items will remain in the cache until requested, at which point they are removed, and `undefined` is returned.
- `aggressive` - Cache will remove expired items as soon as they are discovered.

##### `disabled`
##### `enabled`

Determines whether a cache is disabled. Default: `false`.
Determines whether a cache is enabled. Default: `true`.

##### `onExpire`

Expand Down Expand Up @@ -281,7 +281,7 @@ Configure `$http` to use a cache created by `CacheFactory` by default:

```js
app.run(function ($http, CacheFactory) {
$http.defaults.cache = CacheFactory('defaultCache', {
$http.defaults.cache = CacheFactory.createCache('defaultCache', {
maxAge: 15 * 60 * 1000, // Items added to this cache expire after 15 minutes
cacheFlushInterval: 60 * 60 * 1000, // This cache will clear itself every hour
deleteOnExpire: 'aggressive' // Items will be deleted from this cache when they expire
Expand Down
6 changes: 3 additions & 3 deletions build_examples/browserify/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var angular = require('angular');
var angular = require('angular')

angular.module('app', [
// this is what you would do in a real app
Expand All @@ -7,5 +7,5 @@ angular.module('app', [
// for the example to work
require('../../dist/angular-cache.js')
]).run(function ($rootScope, CacheFactory) {
$rootScope.test = 'It works! Using ' + (CacheFactory ? 'angular-cache' : 'undefined');
});
$rootScope.test = 'It works! Using ' + (CacheFactory ? 'angular-cache' : 'undefined')
})
11 changes: 5 additions & 6 deletions build_examples/r.js/app.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
define('app', [
'angular',
'angular-cache'
'angular', 'angular-cache'
], function (angular, angularCacheModuleName) {
return angular.module('app', ['angular-cache'])
.run(function ($rootScope) {
$rootScope.test = 'It works! Using ' + angularCacheModuleName;
});
});
.run(function ($rootScope) {
$rootScope.test = 'It works! Using ' + angularCacheModuleName
})
})
26 changes: 11 additions & 15 deletions build_examples/r.js/main.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
require.config({
paths: {
angular: '../../bower_components/angular/angular',
'angular-cache': '../../dist/angular-cache',
},
shim: {
paths: {
angular: '../../bower_components/angular/angular', 'angular-cache': '../../dist/angular-cache'
}, shim: {
'angular': {
exports: 'angular'
}
}
});
})

require([
'angular',
'app'
], function (angular, app) {
angular.element(document.getElementsByTagName('html')[0]).ready(function () {
// bootstrap the app manually
angular.bootstrap(document, ['app']);
});
}
);
'angular', 'app'
], function (angular, app) {
angular.element(document.getElementsByTagName('html')[0]).ready(function () {
// bootstrap the app manually
angular.bootstrap(document, ['app'])
})
})
5 changes: 1 addition & 4 deletions build_examples/r.js/require.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
({
name: 'main',
mainConfigFile: 'main.js',
out: 'bundle.js',
optimize: 'none'
name: 'main', mainConfigFile: 'main.js', out: 'bundle.js', optimize: 'none'
})
8 changes: 4 additions & 4 deletions build_examples/webpack/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var angular = require('angular');
var angularCacheModuleName = require('angular-cache');
var angular = require('angular')
var angularCacheModuleName = require('angular-cache')

var app = angular.module('app', [
angularCacheModuleName
]).run(function ($rootScope) {
$rootScope.test = 'It works, imported ' + angularCacheModuleName;
});
$rootScope.test = 'It works, imported ' + angularCacheModuleName
})
8 changes: 3 additions & 5 deletions build_examples/webpack/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
module.exports = {
entry: './app.js',
output: {
entry: './app.js', output: {
filename: 'bundle.js'
},
resolve: {
}, resolve: {
alias: {
'angular-cache': '../../dist/angular-cache.js'
}
}
};
}
8 changes: 4 additions & 4 deletions build_examples/webpack_es6/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import angular from 'angular';
import angularCacheModuleName from 'angular-cache';
import angular from 'angular'
import angularCacheModuleName from 'angular-cache'

let app = angular.module('app', [
angularCacheModuleName
]).run($rootScope => {
$rootScope.test = 'It works, imported ' + angularCacheModuleName;
});
$rootScope.test = 'It works, imported ' + angularCacheModuleName
})
11 changes: 4 additions & 7 deletions build_examples/webpack_es6/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
module.exports = {
entry: './app.js',
output: {
entry: './app.js', output: {
filename: 'bundle.js'
},
resolve: {
}, resolve: {
alias: {
'angular-cache': '../../dist/angular-cache.js'
}
},
module: {
}, module: {
loaders: [
{ test: /(.+)\.js$/, loader: 'babel-loader?blacklist=useStrict' }
]
}
};
}
8 changes: 4 additions & 4 deletions build_examples/webpack_es6_2/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'angular';
import 'angular-cache';
import 'angular'
import 'angular-cache'

let app = angular.module('app', [
'angular-cache'
]).run(($rootScope, CacheFactory) => {
$rootScope.test = 'It works, imported ' + (CacheFactory ? 'angular-cache' : 'undefined');
});
$rootScope.test = 'It works, imported ' + (CacheFactory ? 'angular-cache' : 'undefined')
})
11 changes: 4 additions & 7 deletions build_examples/webpack_es6_2/webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
module.exports = {
entry: './app.js',
output: {
entry: './app.js', output: {
filename: 'bundle.js'
},
resolve: {
}, resolve: {
alias: {
'angular-cache': '../../dist/angular-cache.js'
}
},
module: {
}, module: {
loaders: [
{ test: /(.+)\.js$/, loader: 'babel-loader?blacklist=useStrict' }
]
}
};
}
Loading