kyriosli / node-shared-cache

An interprocess shared LRU cache module for Node.JS
149 stars 30 forks source link

Does not work on OSX #1

Open breedx2 opened 8 years ago

breedx2 commented 8 years ago

The node process hangs hard on OSX when attempting to write to a cache or enumerate the keys. Is this intentional? If only Linux is supported, please update the readme to indicate such. Thanks!

kyriosli commented 8 years ago

Hey, I have just tested on osx and all works fine for me. Could you supply a little more specific information why it does not work?

mgttt commented 7 years ago
const memory_cache = require('node-shared-cache');
const logger=console;
var card_cache;
try{
    //memory_cache.release('prod');
    card_cache = new memory_cache.Cache("prod", 654321);
}catch(ex){
    logger.log('new memory_cache.Cache("prod").ex=',ex);
    memory_cache.release('prod');
    card_cache = new memory_cache.Cache("prod", 654321);
}

function _checkCache(){
    var _size=0;
    for(var i in card_cache){
        _size++;
    }
    card_cache['_'+Math.floor(Math.random()*10000)]=(new Date()).getTime();
    logger.log('card_cache _size=',_size);
    setTimeout(()=>{
        _checkCache();
    },3333);
}
_checkCache();

the error is:

new memory_cache.Cache("prod").ex= Error: cache initialized with different size
mgttt commented 7 years ago

seems two differnt process cannot share one cache at OSX