Sha256: e44faf1132102051325a66776199f562e0d3e2115ef15d51860b829fd9814c93
Contents?: true
Size: 792 Bytes
Versions: 2
Compression:
Stored size: 792 Bytes
Contents
/** A two-tiered cache with support for fallback values when doing lookups. Uses "buckets" and then "keys" to cache values. @private @class BucketCache */ export default class BucketCache { constructor() { this.cache = new Map(); } has(bucketKey) { return this.cache.has(bucketKey); } stash(bucketKey, key, value) { let bucket = this.cache.get(bucketKey); if (bucket === undefined) { bucket = new Map(); this.cache.set(bucketKey, bucket); } bucket.set(key, value); } lookup(bucketKey, prop, defaultValue) { if (!this.has(bucketKey)) { return defaultValue; } let bucket = this.cache.get(bucketKey); if (bucket.has(prop)) { return bucket.get(prop); } else { return defaultValue; } } }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.5.1.1 | dist/es/ember-routing/lib/system/cache.js |
discourse-ember-source-3.5.1.0 | dist/dist/es/ember-routing/lib/system/cache.js |