Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Define database queries with redis? Redis is an in-memory key-value database so you can't run SQL queries.
Let me know! -
Wombat102476y@linuxxx I mean like caching the results. I use a MySQL database.
I query the database if there is no data in Redis. Then I store the data in redis for 24h. If there is I just render with the data from Redis. -
@Wombat Put data in redis where the key is something identifiable (with a prefix maybe?) and put the content as value. You can also set a TTL for redis records.
This is the exact way of how I handle much-security.nl :) (working on a new article as we speak by the way ;) -
Wombat102476y@linuxxx that is exactly what I do. I was wondering about problems I will face with this setup. I dunno...
Mind sharing, when you finish? -
-
@Wombat how are u dealing with cache updates when those queries become out of date?
-
@linuxxx does it really make sense to use a redis cache for much-security.nl? I mean, how much traffic do you get and at what point do you decide that caching is needed?
Also there's a random "string () """ text on the top of the much-security website and the FB post is rendered twice -
Wombat102476y@DanTzuBoi you can set expiration on keys in Redis. I also set a flag on the posts table, when it's set posts get cached for 24h.
-
@linuxxx just curioys. I think I already know the answer, but...
Would reddis happen to have a dependency tree evict mechanism? Like defining which keys key A depends on? So that chanding any of dependencies A would be ruled invalid?
Now I'm doing all the deps mgmt in-app. Doesn't seem to be very efficient :) -
@RememberMe I know about the string and the fb post and nope, caching isn't needed but I just like the site to be very fast :)
Related Rants
I've implemented an in memory caching system for database queries with Redis in one of the blogs I manage.
Will it work well? Or do you think it will produce issues? I have no experience with Redis yet.
question
redis
cache