1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
### 2.x.x. ---> 3.x.x - xx April 2013
TODO
### 1.x.x. ---> 2.0.0 - 30 October 2013
#### Breaking API changes
##### Swapped `aggressiveDelete` option for `deleteOnExpire` option.
###### 1.x.x
Aggressively delete expiring items.
```javascript
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
aggressiveDelete: true // Items will be actively deleted when they expire
});
```
Passively delete items when they are requested after they have expired.
```javascript
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
aggressiveDelete: false // Items will be actively deleted when they expire
});
```
###### 2.0.0
Aggressively delete expiring items.
```javascript
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
deleteOnExpire: 'aggressive' // Items will be actively deleted when they expire
});
```
Passively delete items when they are requested after they have expired.
```javascript
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
deleteOnExpire: 'passive' // Items will be passively deleted when requested after expiration
});
```
Do nothing with expired items (not in 1.x.x).
```javascript
$angularCacheFactory('myNewCache', {
maxAge: 90000, // Items added to this cache expire after 15 minutes
deleteOnExpire: 'none' // Items will expire but not be removed
});
```
##### Substituted `localStorageImpl` and `sessionStorageImpl` options for just `storageImpl` option.
###### 1.x.x
```javascript
$angularCacheFactory('myNewCache', {
storageMode: 'localStorage',
localStorageImpl: myLocalStoragePolyfill // Use custom localStorage implementation
});
$angularCacheFactory('myNewCache2', {
storageMode: 'sessionStorage',
sessionStorageImpl: mySessionStoragePolyfill // Use custom sessionStorage implementation
});
```
###### 2.0.0
```javascript
$angularCacheFactory('myNewCache', {
storageMode: 'localStorage',
storageImpl: myLocalStoragePolyfill // Use custom localStorage implementation
});
$angularCacheFactory('myNewCache2', {
storageMode: 'sessionStorage',
storageImpl: mySessionStoragePolyfill // Use custom sessionStorage implementation
});
```
##### Installation
The Bower package now contains only `dist/angular-cache.js` and `dist/angular-cache.min.js`.
##### onExpire
###### 1.x.x
```javascript
cache.get('someKey', function (key, value) {
// do something with expired item
});
```
###### 2.0.0
```javascript
cache.get('someKey', {
onExpire: function (key, value) {
// do something with expired item
}
});
```
|