kyriosli / node-shared-cache

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

Error trying to run example #11

Closed richardgoater closed 7 years ago

richardgoater commented 7 years ago
Error: cache initialized with different size

Trying to run the example in the readme on Ubuntu 17.04 using node v8.1.2. Any ideas?

kyriosli commented 7 years ago

This error indicates that the memory region allocated has the right MAGIC code and a wrong size info. It may be initiated with different parameters. Could you give more information about which test code was ran? Or you can just free the pre-allocated memory by running rm /run/shm/{cache_name} or /dev/shm/{}. Frankly by the way, I did't run it on node-v7 or higher platforms, so please be kind enough to supply more info.

richardgoater commented 7 years ago

Thanks very much for the quick reply, sir. The test I ran is as follows:

var cache = require('node-shared-cache');
var obj = new cache.Cache("test", 512<<10);

// setting property
obj.foo = "bar";

// getting property
console.log(obj.foo);

amazingly this is working today without any changes. Deleting the shm entries helped when running the project tests. Sorry for wasting your time and thanks for your work, closing this issue.