Socket
Socket
Sign inDemoInstall

cacache

Package Overview
Dependencies
Maintainers
2
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacache - npm Package Compare versions

Comparing version 6.2.0 to 6.3.0

17

CHANGELOG.md

@@ -5,2 +5,19 @@ # Change Log

<a name="6.3.0"></a>
# [6.3.0](https://github.com/zkat/cacache/compare/v6.2.0...v6.3.0) (2017-04-01)
### Bug Fixes
* **fixOwner:** ignore EEXIST race condition from mkdirp ([4670e9b](https://github.com/zkat/cacache/commit/4670e9b))
* **index:** ignore index removal races when inserting ([b9d2fa2](https://github.com/zkat/cacache/commit/b9d2fa2))
* **memo:** use lru-cache for better mem management (#75) ([d8ac5aa](https://github.com/zkat/cacache/commit/d8ac5aa))
### Features
* **dependencies:** Switch to move-concurrently (#77) ([dc6482d](https://github.com/zkat/cacache/commit/dc6482d))
<a name="6.2.0"></a>

@@ -7,0 +24,0 @@ # [6.2.0](https://github.com/zkat/cacache/compare/v6.1.2...v6.2.0) (2017-03-15)

32

lib/entry-index.js

@@ -33,12 +33,12 @@ 'use strict'

const bucket = bucketPath(cache, key)
const entry = {
key: key,
digest: digest,
hashAlgorithm: opts.hashAlgorithm || 'sha512',
time: +(new Date()),
metadata: opts.metadata
}
return fixOwner.mkdirfix(
path.dirname(bucket), opts.uid, opts.gid
).then(() => {
const entry = {
key: key,
digest: digest,
hashAlgorithm: opts.hashAlgorithm || 'sha512',
time: +(new Date()),
metadata: opts.metadata
}
const stringified = JSON.stringify(entry)

@@ -54,8 +54,14 @@ // NOTE - Cleverness ahoy!

bucket, `\n${hashEntry(stringified)}\t${stringified}`
).then(() => entry)
}).then(entry => (
fixOwner.chownr(bucket, opts.uid, opts.gid).then(() => (
formatEntry(cache, entry)
))
))
)
}).then(
() => fixOwner.chownr(bucket, opts.uid, opts.gid)
).catch({code: 'ENOENT'}, () => {
// There's a class of race conditions that happen when things get deleted
// during fixOwner, or between the two mkdirfix/chownr calls.
//
// It's perfectly fine to just not bother in those cases and lie
// that the index entry was written. Because it's a cache.
}).then(() => {
return formatEntry(cache, entry)
})
}

@@ -62,0 +68,0 @@

'use strict'
let MEMOIZED = {}
const LRU = require('lru-cache')
const MAX_SIZE = 50 * 1024 * 1024 // 50MB
const MAX_AGE = 3 * 60 * 1000
let MEMOIZED
clearMemoized()
module.exports.clearMemoized = clearMemoized
function clearMemoized () {
var old = MEMOIZED
MEMOIZED = {}
MEMOIZED = new LRU({
max: MAX_SIZE,
maxAge: MAX_AGE,
length: (entry, key) => {
if (key.startsWith('key:')) {
return entry.data.length
} else if (key.startsWith('digest:')) {
return entry.length
}
}
})
return old

@@ -10,0 +26,0 @@ }

@@ -40,3 +40,6 @@ 'use strict'

}
}).catch({code: 'EEXIST'}, () => {
// There's a race in mkdirp!
return fixOwner(p, uid, gid).then(() => null)
})
}

@@ -44,3 +44,3 @@ 'use strict'

// file doesn't already exist! let's try a rename -> copy fallback
if (!move) { move = require('@npmcorp/move') }
if (!move) { move = require('move-concurrently') }
return move(src, dest, { BB, fs })

@@ -47,0 +47,0 @@ })

{
"name": "cacache",
"version": "6.2.0",
"version": "6.3.0",
"cache-version": {

@@ -49,3 +49,3 @@ "content": "2",

"dependencies": {
"@npmcorp/move": "^1.0.0",
"move-concurrently": "^1.0.0",
"bluebird": "^3.4.7",

@@ -56,2 +56,3 @@ "checksum-stream": "^1.0.2",

"graceful-fs": "^4.1.10",
"lru-cache": "^4.0.2",
"mississippi": "^1.2.0",

@@ -64,11 +65,11 @@ "mkdirp": "^0.5.1",

"devDependencies": {
"benchmark": "^2.1.3",
"benchmark": "^2.1.4",
"chalk": "^1.1.3",
"nyc": "^10.0.0",
"nyc": "^10.2.0",
"require-inject": "^1.4.0",
"safe-buffer": "^5.0.1",
"standard": "^9.0.1",
"standard": "^9.0.2",
"standard-version": "^4.0.0",
"tacks": "^1.2.2",
"tap": "^10.3.0",
"tap": "^10.3.1",
"weallbehave": "^1.0.0",

@@ -75,0 +76,0 @@ "weallcontribute": "^1.0.8"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc