delta-cache

0.2.0 • Public • Published

delta-cache-node

Node server-side support for delta caching

Complies with the RFC 3229 delta encoding spec with googlediffjson encoded deltas, so it works with delta-cache-browser.

Getting Started

var createDeltaCache = require('delta-cache');
 
var deltaCache = createDeltaCache();
var server = http.createServer((req, res) => {
  deltaCache(req, res, 'sample dynamic response ' + new Date().toString());
});

API

createDeltaCache()

Returns a DeltaCache instance.

Class: DeltaCache

This class internally contains file versions that are saved to disk.

deltaCache.respondWithDeltaEncoding(req, res, data[, fileId][, callback])

Sends a response with data to the client, using delta encoding if possible. If fileId is not given, it defaults to the path of the request URL. The parameter fileId identifies the file in the server version history, so a second request to the same fileId will give a delta encoded response (provided the client cached the first).

All versions of data are stored in disk in the filesystem as temporary files, and will be deleted when the Node process exits. To see the implementation of the version cache, see delta-history.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.2.0
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.2.0
    1
  • 0.1.2
    0
  • 0.1.1
    0
  • 0.1.0
    0

Package Sidebar

Install

npm i delta-cache

Weekly Downloads

1

Version

0.2.0

License

MIT

Last publish

Collaborators

  • wmsmacdonald