use Redis cache instead of in memory cache
-
Is it possible? Yes. Is it worth doing? Probably not
You would have to override core functions like
Topics.getTopicData/Topics.geetTopicsFields
and write your own implementation that uses redis as a cache layer. NodeBB database layer lets you store anything you want as a key/value store. -
I think they meant the post cache - AFAIK topic data isn't cached currently.
For that all you'd need to override (or modify directly in NodeBB) is the LRU Cache which would make your changes apply to almost all caches in NodeBB (file upload limits are using a TTL cache instead, but that's probably even less worth moving somewhere else)
EDIT: note that this still isn't endorsement of actually doing this. Unless you need to run many instances of NodeBB and memory constraints mean you need to share the cache, you'll probably end up slowing things down.
-
Topic data is cached in memory if you are using redis or mongodb, pretty much all calls to
db.getObject
and it's variants are cached. https://github.com/NodeBB/NodeBB/blob/master/src/database/mongo/hash.js#L126-L135This is the
object cache
that you see in the ACP. The post cache in the ACP refers to the parsing of thecontent
field of post objects. -
@baris tbf that's also using cache/lru