0.2.0 • Published 7 years ago

delta-cache v0.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

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)

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.

0.2.0

7 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago