Sha256: 2003457c059a042e276e106a7c185782e06498c6f60f12630a620164c4cd40be
Contents?: true
Size: 907 Bytes
Versions: 17
Compression:
Stored size: 907 Bytes
Contents
class Turbolinks.SnapshotCache constructor: (@size) -> @keys = [] @snapshots = {} has: (location) -> key = keyForLocation(location) key of @snapshots get: (location) -> return unless @has(location) snapshot = @read(location) @touch(location) snapshot put: (location, snapshot) -> @write(location, snapshot) @touch(location) snapshot # Private read: (location) -> key = keyForLocation(location) @snapshots[key] write: (location, snapshot) -> key = keyForLocation(location) @snapshots[key] = snapshot touch: (location) -> key = keyForLocation(location) index = @keys.indexOf(key) @keys.splice(index, 1) if index > -1 @keys.unshift(key) @trim() trim: -> for key in @keys.splice(@size) delete @snapshots[key] keyForLocation = (location) -> Turbolinks.Location.wrap(location).toCacheKey()
Version data entries
17 entries across 16 versions & 8 rubygems