node-shared-cache icon indicating copy to clipboard operation
node-shared-cache copied to clipboard

Does not work on OSX

Open breedx2 opened this issue 8 years ago • 3 comments

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!

breedx2 avatar Apr 12 '16 02:04 breedx2

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?

kyriosli avatar Apr 15 '16 06:04 kyriosli

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 avatar Jul 08 '17 07:07 mgttt

seems two differnt process cannot share one cache at OSX

mgttt avatar Jul 08 '17 07:07 mgttt