1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-29 09:31:11 -05:00
forgejo/modules/cache
zeripath 2f725cbc9e
Add LRU mem cache implementation (#16226)
The current default memory cache implementation is unbounded in size and number of
objects cached. This is hardly ideal.

This PR proposes creating a TwoQueue LRU cache as the underlying cache for Gitea.
The cache is limited by the number of objects stored in the cache (rather than size)
for simplicity. The default number of objects is 50000 - which is perhaps too small
as most of our objects cached are going to be much less than 1kB.

It may be worth considering using a different LRU implementation that actively limits
sizes or avoids GC - however, this is just a beginning implementation.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2021-07-10 23:54:15 +02:00
..
cache.go Ensure memcache TTL cannot be over 30 days (#14592) 2021-02-09 22:29:03 +00:00
cache_redis.go [Vendor] Update go-redis to v8.5.0 (#13749) 2021-02-10 21:28:32 +00:00
cache_test.go Add some Unit-Tests (#14500) 2021-01-28 19:08:11 +01:00
cache_twoqueue.go Add LRU mem cache implementation (#16226) 2021-07-10 23:54:15 +02:00