sarkistlt / feathers-redis-cache Goto Github PK
View Code? Open in Web Editor NEWSet of Redis caching hooks and routes for feathersjs.
Set of Redis caching hooks and routes for feathersjs.
I have a query that is like this.
{
$and: [
{ tags: { $in: ['5d27187cdcfb01b6e35e04fe', '5d2718dddcfb01022b5e0505'] } },
{ product: '5debaed9ee579bdd6036f353' }
];
}
however when that is cached it's converted to $and=[object Object],[object Object]
which means the same result is returned regardless of the $and query.
I've noticed that if I remove arrayFormat: 'comma'
from the stringify options the result looks much better so was wondering if there is a particular reason for this being set as feathers-rest doesn't use it. https://github.com/feathersjs-ecosystem/feathers-rest/blob/master/src/client/base.js
$and[0][tags][$in][0]=5d27187cdcfb01b6e35e04fe&$and[0][tags][$in][1]=5d2718dddcfb01022b5e0505&$and[1][product]=5debaed9ee579bdd6036f353
Redis-x64-3.2.100 - Windows
"feathers-redis-cache": "^1.2.1",
Purge that is error.
{ message: "ERR unknown command 'unlink'", status: 500 }
We're using groups to store our keys and then use these groups to delete keys in batches.
It seems that due to this line of the purgeGroup
function it might be returning a false negative result, scan returns an empty list for some cases that there are keys present for a given group.
Here is an example of this happening, when we used RedisInsight:
command used by feathers-redis-cache
scan 0 "MATCH" "abc_123*" "COUNT" "1000"
Output
1) "845" 2) (empty list or set)
command used for testing purposes
scan 0 "MATCH" "abc_123*" "COUNT" "10000"
Output
1) "0" 2) 1) "abc_123-AAAA" 2) "abc_123-BBBBB" 3) "abc_123-CCCCC"
Just wondering if you have any suggestions for the best way to use with fastjoin. I'm assuming it should implemented after the fastjoin but I don't want fastjoin to then run on a cached response as that would defeat the purpose.
Would this be the correct way to do it?
get: [
isNot(hook => hook.params.$skipCacheHook, fastJoin(viewResolver)),
redisCache.hooks.after({ expiration: 3600 * 24 * 7 })
],
Hi! First of all, nice project you got here, thanks for sharing it :)
We tried using this hook in a project we're about to finish, but when we did some load testing, we found some problems that cause slowdown and high memory usage.
After noticing these problems and finding the issue, I saw in your TODO list this: "option in after hook to set limit of keys per group". I believe that is a must for a production environment.
But anyways, that is not the problem per se (although it's closely related).
After many load tests, I noticed that the group list in redis was huge. When I analyzed the code, I noticed two things that contribute to this problem:
I suggest that instead of creating the group list, maybe put the group as a cache key prefix, and when purging, just use the "keys" function to find all keys related to that group. Some care would have to be taken to avoid problems with groups named with a same prefix and things like that. I haven't exactly put a lot of thought into this, but these were the first things that came to my mind.
I may find some time in the near future to make a pull request addressing this issue, but I believe caching won't be a priority for us at the moment, so it may take some time.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.