Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Releasing into the wilds.

  • Loading branch information...
commit aa1135096b9ecd3b75ccaf046d8575ed0851cf92 1 parent 49cec11
@ironwallaby ironwallaby authored
Showing with 24 additions and 20 deletions.
  1. +19 −15 README.md
  2. +5 −5 package.json
View
34 README.md
@@ -1,21 +1,21 @@
-Cache
-=====
+cache-helpers
+=============
-`cache` is a Node.JS module containing several generic caching functions. It
-was written as a way of abstracting out a number of commonly used patterns in
-the Dark Sky API.
+`cache-helpers` is a Node.JS module containing several generic caching
+functions. It was written as a way of abstracting out a number of commonly used
+patterns in the [Dark Sky API](http://developer.darkskyapp.com/).
-* `cache.once`: Takes a (presumably expensive) function which takes a single
- callback and calls it with an optional error argument and a data argument.
- It returns a function that you may use as a proxy for the passed function.
- The first time it is called, it will call the function and cache it's data.
- Subsequent calls will return the cached data.
+* `cacheHelpers.once`: Takes a (presumably expensive) function which takes a
+ single callback and calls it with an optional error argument and a data
+ argument. It returns a function that you may use as a proxy for the passed
+ function. The first time it is called, it will call the function and cache
+ its data. Subsequent calls will return the cached data.
(It is smart enough to only call the backing function once even if it is
called many times simultaneously.)
-* `cache.timeBasedWithGrace`: Takes a (presumably expensive) function, like
- `once`, above, and two numbers: a soft cache timeout and a hard cache
+* `cacheHelpers.timeBasedWithGrace`: Takes a (presumably expensive) function,
+ like `once`, above, and two numbers: a soft cache timeout and a hard cache
timeout. These timeouts may be in any arbitrary units you prefer, though
either seconds or milliseconds is most convenient. Like `once`, it returns
a proxy function, which is called with the current time (in whatever units
@@ -38,12 +38,16 @@ the Dark Sky API.
(Like `once`, this function is smart enough to not call the backing
function more often than necessary.)
-* `cache.sizeBasedKeyValue`: Similar to the others. Takes a function and a
- maximum cache size. The passed function is expected to take a key parameter
- and a callback. The function returned by this method will take the same.
+* `cacheHelpers.sizeBasedKeyValue`: Similar to the others. Takes a function
+ and a maximum cache size. The passed function is expected to take a key
+ parameter and a callback. The function returned by this method will take
+ the same.
If the cache gets full and a new item is requested, the least-recently-used
item is purged.
(Like the other functions, this function is also smart enough to not call
the backing function more often than necessary.)
+
+These are kind of advanced, and may be fairly hard to understand without a
+concrete use case. Checking out the tests may help.
View
10 package.json
@@ -1,17 +1,17 @@
{
- "name": "cache",
- "version": "1.2.0",
+ "name": "cache-helpers",
+ "version": "1.3.0",
"description": "caching convenience functions",
"keywords": [
"caching"
],
"author": {
- "name": "J.T.L.",
- "email": "ironwallaby@gmail.com"
+ "name": "The Dark Sky Company",
+ "email": "devsupport@darkskyapp.com"
},
"repository": {
"type": "git",
- "url": "git://github.com/ironwallaby/cache.git"
+ "url": "git://github.com/darkskyapp/cache-helpers.git"
},
"dependencies": {
},
Please sign in to comment.
Something went wrong with that request. Please try again.