profile
viewpoint
Bryan Donovan BryanDonovan Portland, OR

BryanDonovan/node-cache-manager 701

Cache module for Node.JS

BryanDonovan/digital-dice-book-solutions 4

Assorted solutions to the book Digital Dice by Paul J. Nahin

BryanDonovan/acts_as_money 3

an Active Record plugin that makes it easier to work with the money gem

BryanDonovan/node-couchbase-example 2

Example Node.js application using Couchbase via couchnode npm.

BryanDonovan/curb-fu 1

Simple, yet powerful wrapper for taf2's curb (libcurl) library

BryanDonovan/horaa 1

Mocking NodeJS Modules

BryanDonovan/mockery 1

Simplifying the use of mocks with Node.js

BryanDonovan/automateit 0

AutomateIt is an open source tool for automating the setup and maintenance of servers, applications and their dependencies.

BryanDonovan/couchnode 0

libcouchbase node.js access

issue commentBryanDonovan/node-cache-manager

No uniform way of defining an inifinite ttl

No problem!

jbeaudoin11

comment created time in a month

issue commentBryanDonovan/node-cache-manager

No uniform way of defining an inifinite ttl

I left get to simply retrieve from cache and not do any implicit updates. I could see the case to have it do an update as well, but that's really what wrap is for.

jbeaudoin11

comment created time in a month

issue commentBryanDonovan/node-cache-manager

No uniform way of defining an inifinite ttl

Yeah, it should get set in the local cache for B. This test demonstrates that: https://github.com/BryanDonovan/node-cache-manager/blob/master/test/multi_caching.unit.js#L1693

jbeaudoin11

comment created time in a month

issue commentBryanDonovan/node-cache-manager

No uniform way of defining an inifinite ttl

Hmm... actually, are you sure using 0 for ttl is not working? This example seems to work for me:

const cacheManager = require('cache-manager');
const memoryCache = cacheManager.caching({store: 'memory', max: 100, ttl: 0});

function getUser(id, cb) {
    setTimeout(() => {
        console.log("Fetching user from slow database.");
        cb(null, {id: id, name: 'Bob'});
    }, 100);
}

const userId = 123;

function getCachedUser(id, cb) {
    memoryCache.wrap(id, cacheCallback => {
        getUser(id, cacheCallback);
    }, cb);
}

getCachedUser(userId, (err, user) => {
    // First time fetches the user from the (fake) database:
    console.log('Fetched user:', user);

    setTimeout(() => {
        getCachedUser(userId, (err, user) => {
            // Second time fetches from cache.
            console.log('Fetched user:', user);
            process.exit();
        });
    }, 1010);
});

The output is:

Fetching user from slow database.
Fetched user: { id: 123, name: 'Bob' }
Fetched user: { id: 123, name: 'Bob' }

(which shows that it's only fetching from the "database" once).

jbeaudoin11

comment created time in a month

issue commentBryanDonovan/node-cache-manager

No uniform way of defining an inifinite ttl

How would noTtl work with lru-cache?

jbeaudoin11

comment created time in a month

issue commentBryanDonovan/node-cache-manager

No uniform way of defining an inifinite ttl

The problem is that I can't arbitrarily decide that a ttl of zero means infinite for all stores. All we can do is pass it to the underlying store. I didn't want to define the behavior of passing zero to lru-cache because they could change how it works and then cache-manager's docs would be wrong. Still, I could clarify the docs.. I'll do that when I have a bit of spare time.

jbeaudoin11

comment created time in a month

issue commentBryanDonovan/node-cache-manager

No uniform way of defining an inifinite ttl

Sorry, I can't do anything about how the underlying stores work..

jbeaudoin11

comment created time in a month

issue commentBryanDonovan/node-cache-manager

How to disable cache in development?

Oh, cool. I think someone else bumped it for a security reason. Glad it's faster too..

fookit

comment created time in a month

issue commentBryanDonovan/node-cache-manager

How to disable cache in development?

Sorry for the delayed response. Yeah, what @curtdept said. You basically have to manually turn cache on or off. Also, a ttl of 0 results in there being no ttl at all.

fookit

comment created time in a month

created tagBryanDonovan/node-cache-manager

tag3.4.0

Cache module for Node.JS

created time in 2 months

pull request commentBryanDonovan/node-cache-manager

Update dependencies

This is in version 3.4.0

orgads

comment created time in 2 months

push eventBryanDonovan/node-cache-manager

Bryan Donovan

commit sha 9bc3481dda756aa95a3f018be263f0639826c4e1

Merge branch 'release/3.3.0' into develop

view details

Orgad Shaneh

commit sha eba9311872eb13434a9a300ac6c2a7206883ecc3

Update dependencies

view details

Bryan Donovan

commit sha 263a9977536a23fe9172459d6209c82561a2a60b

Merge pull request #145 from orgads/update-deps Update dependencies

view details

Bryan Donovan

commit sha 924cb79391b01e381c0f96924c43f357b6a45a49

3.4.0

view details

Bryan Donovan

commit sha 00e688c5b1de6e88446f6bc800b04094b2c7ebba

Merge branch 'release/3.4.0'

view details

push time in 2 months

push eventBryanDonovan/node-cache-manager

Bryan Donovan

commit sha 924cb79391b01e381c0f96924c43f357b6a45a49

3.4.0

view details

Bryan Donovan

commit sha 72369aa736677f0e18eca9b553d9cb3d56fbb8c0

Merge branch 'release/3.4.0' into develop

view details

push time in 2 months

push eventBryanDonovan/node-cache-manager

Bryan Donovan

commit sha 141858e719914d0a982c8ae5faba830283b09c68

Merge branch 'release/3.1.0'

view details

Bryan Donovan

commit sha 47394382c265de9f845993483519211d25f59a3d

Merge branch 'release/3.2.0'

view details

Bryan Donovan

commit sha 227fb2119e5e124ab9e6895beac13cbe11bccbf5

Merge branch 'release/3.2.1'

view details

Bryan Donovan

commit sha 8874b2927f28e59c31d5a1d96e0dee07236f5e68

Merge branch 'release/3.3.0'

view details

Orgad Shaneh

commit sha eba9311872eb13434a9a300ac6c2a7206883ecc3

Update dependencies

view details

Bryan Donovan

commit sha 263a9977536a23fe9172459d6209c82561a2a60b

Merge pull request #145 from orgads/update-deps Update dependencies

view details

push time in 2 months

PullRequestReviewEvent

pull request commentBryanDonovan/node-cache-manager

Update dependencies

Sorry, I've been on vacation. I'll try to get to this today.

orgads

comment created time in 2 months

more