Gathering detailed insights and metrics for magazine
Gathering detailed insights and metrics for magazine
Gathering detailed insights and metrics for magazine
Gathering detailed insights and metrics for magazine
npm install magazine
Typescript
Module System
Node Version
NPM Version
70.7
Supply Chain
99.3
Quality
76.1
Maintenance
100
Vulnerability
100
License
Magazine v6.0.0-alpha.10
Updated on Feb 07, 2022
Magazine v6.0.0-alpha.9
Updated on Jul 23, 2021
Magazine v6.0.0-alpha.8
Updated on Jul 22, 2021
Magazine v6.0.0-alpha.7
Updated on Mar 23, 2021
Magazine v6.0.0-alpha.6
Updated on Jan 16, 2021
Magazine v6.0.0-alpha.5
Updated on Jan 02, 2021
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
4 Stars
223 Commits
2 Forks
3 Watchers
4 Branches
1 Contributors
Updated on Sep 08, 2023
Latest Version
5.0.3
Package Id
magazine@5.0.3
Size
3.93 kB
NPM Version
6.4.1
Node Version
10.15.2
Published on
Apr 17, 2019
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
Excellent article about Magazine:
http://francescomari.github.io/2014/06/26/the-magazine-cache.html
Magazine is a least-recently used cache in JavaScript that divides a common cache into one or more individual collections.
Here is the basic usage.
1// create a cache 2var Cache = require('magazine') 3var cache = new Cache 4 5// create a magazine that stores to the cache 6var magazine = cache.createMagazine() 7 8// hold and release to key/value pairs to get them into the magazine 9magazine.hold('one', { number: 1 }).release() 10magazine.hold('two', { number: 2 }).release() 11 12// wait a second 13setTimeout(afterOneSecond, 1000) 14 15function afterOneSecond () { 16 // after a second hold and release one of the keys to refresh it 17 magazine.hold('one', null).release() 18 19 // wait another second 20 setTimeout(afterTwoSeconds, 1000) 21} 22 23function afterTwoSeconds () { 24 // after two seconds, purge anything that is older than a second and a half 25 cache.expire(Date.now() - 1500) 26 27 // hold the one cartidge, the given value is the default value to use if the 28 // value does not exist in the cache. 29 var cartridge = magazine.hold('one', { number: null }) 30 31 // check for a cache hit on one 32 if (cartridge.value.number == null) { 33 console.log('one is not in cache') 34 cartridge.remove() 35 } else { 36 console.log('one is in cache') 37 cartridge.release() 38 } 39 40 cartridge = magazine.hold('two', { number: null }) 41 42 // check for a cache hit on two 43 if (cartridge.value.number == null) { 44 console.log('two is not in cache') 45 cartridge.remove() 46 } else { 47 console.log('two is in cache') 48 cartridge.release() 49 } 50}
I created Magazine for use wtih Strata, a b-tree implementation in pure JavaScript. The b-tree implementation needs a cache for pages read from disk. Most applications that use Strata are going to want to use more than one b-tree, but why make the application developer have to think about tuning the page cache for each b-tree? So I created Magazine, a common cache has multiple collections.
new Cache
Create a new cache.
cache.expire(before)
.Purge the cache removing items before the given date.
iterator = cache.purge()
Create an iterator over the cache in least recently used order.
magazine = cache.createMagazine()
Create a magazine using the cache.
magazine.expire(before)
Expire only the items in the current magazine.
cartridge = magazine.hold(key, value)
Hold a cartridge for the given key creating a cartridge if one does not exist.
cartridge.release()
Release the hold on the cartridge.
cartridge.remove()
Remove the hold the cartridge. You must be the only one holding it to remove it.
cartridge.adjustHeft(value)
Adjust the heft of the cartridge. Heft is some arbitrary measure of the weight of cartridge. For cached managed by count, the actual count of items might not be a the cache entry itself. The cache entry could contain an array of items, for example, and user wants to purge the cache when it has more than a total number of items.
cartridge.heft
An arbitrary measure of the weight of the cartridge.
purge.next()
Move to the next oldest entry in the queue.
purge.release()
Releases a cartridge if one is held, a safe way to finalize a purge iteration.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More