src/register.js

Method register

Registers an Etag in the LRU cache

Parameters:

  • url must be a String.
    (URL requested)

  • state must be an Object.
    (Object describing state {etag: $etag, mimetype: $mimetype})

  • stale must be a Boolean.
    ([Optional] Remove cache from disk)

Returns an Object
(TurtleIO instance)

TurtleIO.prototype.register = function ( url, state, stale ) { var cached;

Removing stale cache from disk

if ( stale === true ) { cached = this.etags.cache[url]; if ( cached && cached.value.etag !== state.etag ) { this.unregister( url ); } }

Updating LRU

this.etags.set( url, state ); return this; };