aboutsummaryrefslogtreecommitdiffstats
path: root/src/ng/cacheFactory.js
diff options
context:
space:
mode:
authorJP Sugarbroad2012-11-15 15:18:28 -0800
committerIgor Minar2012-11-25 00:01:34 +0100
commit168db33985aa025eb48bc21087717ab70da0bd72 (patch)
tree149033cbf209d43924138fdf462fe47a422a5694 /src/ng/cacheFactory.js
parent79af2badcb087881e3fd600f6ae5bf3f86a2daf8 (diff)
downloadangular.js-168db33985aa025eb48bc21087717ab70da0bd72.tar.bz2
feat($cacheFactory): cache.put now returns the added value
This allows common programming patterns to be expressed with more concise code. See #1583 for code examples.
Diffstat (limited to 'src/ng/cacheFactory.js')
-rw-r--r--src/ng/cacheFactory.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ng/cacheFactory.js b/src/ng/cacheFactory.js
index 2ff02a37..ce690ebf 100644
--- a/src/ng/cacheFactory.js
+++ b/src/ng/cacheFactory.js
@@ -14,7 +14,7 @@
* @returns {object} Newly created cache object with the following set of methods:
*
* - `{object}` `info()` — Returns id, size, and options of cache.
- * - `{void}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache.
+ * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns it.
* - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
* - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
* - `{void}` `removeAll()` — Removes all cached values.
@@ -53,6 +53,8 @@ function $CacheFactoryProvider() {
if (size > capacity) {
this.remove(staleEnd.key);
}
+
+ return value;
},