trailsjs / trailpack-cache

:package: Cache Trailpack
MIT License
3 stars 5 forks source link

Wrong usage of multicache #13

Closed jaumard closed 7 years ago

jaumard commented 8 years ago

Ok I did into the code a little a I think the usage of multicache is wrong here https://github.com/trailsjs/trailpack-cache/blob/master/api/services/CacheService.js#L64

Because if I have multi store like mongo, memory and fs and do getCaches('fs'), it will not return me a fs cache, it will return a multicache instance witch use all stores. That's not what I want at all. I want to be able to use store separately witch is currently not possible with this implementation.

My proposal is : getCaches() => return multicache instance if multiple store getCaches(name) => return single instance of the given store name

jaumard commented 8 years ago

This apply that your current implementation of singleton @maissani is no more correct. Because with your actual implementation you have only one singleton where in my proposal you'll have one singleton per store

jaumard commented 8 years ago

any date about this issue @maissani ? it make this trailpack useless when you want to use multiple store separately (because you can't retrieve them at all separately)

jaumard commented 7 years ago

Little up here :)