Sha256: cf1fbef0f7595e1c162a6ae864c6c8500df3234ea71244de91c09b0a0cd2009c
Contents?: true
Size: 888 Bytes
Versions: 1
Compression:
Stored size: 888 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
discourse-ember-source-3.6.0.0 | dist/es/@ember/-internals/routing/lib/system/cache.js |