I have to build an app with redis and phpredis which store logs and show logs.
I need to sort and query before display this logs.
Log model :
id -> 12
group -> sql
level -> error
message -> query return an error
timestamp -> 123423343
url -> htpp://...
Exemple of query :
-> Show me logs with group = sql and level = error
-> Show me all logs
-> Show me logs with group = sql and timestamp < 1342163216 && >1585876877
Then the result need to be ordered by id (ASC).
So I want to know if it's possible? And what model choose?
I've try string, hash, set, list but I can't do everything I want.
Redis is good for cache system. So you cannot query to redis like that. But you can build inverted-index using Sets or SortedSet on Redis.
field name and value ( group.sql , level.error, level.info ) can be key (term) and log id can be value ( posting ) in inverted-index.
Using that index you can get the result of query of first case in example. But it cannot cover all ad hoc queries like SQL