UNPKG

elsewhere

Version:

A node project that aims to replicate the functionality of the Google Social Graph API

31 lines (25 loc) 1.14 kB
--- category: reference --- Elsewhere use an in-memory cache to store the HTML of web pages. The options object contains a property called `cacheTimeLimit` that can be used to set the cache refresh time. By default, this is 3600000ms (1 hour). The number of items stored in the cache can be limited using the options property `cacheItemLimit`. By default, the cache is limited to 1000 items. You can replace the cache with your own, for example, to store the cached date in a database or file system. To add you own custom cache, all you need to do is provide an object with the following interface: { get: function (url) { // add code to get data return data }, has: function (url) { // add code to check your data store return true or false }, fetch: function (url, callback) { // add code to return data callback(null, data); }, set: function (url, data) { // add code to store data return object } } You must then add this object as the `cache` property of the options object passed into the `graph()` method.