diff options
author | zeripath <art27@cantab.net> | 2021-07-10 22:54:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-10 23:54:15 +0200 |
commit | 2f725cbc9e836e1d11b8645ee11ed2c82da8c0b7 (patch) | |
tree | 4528863d2c546dc3126970bff029334694d80e80 /docs/content | |
parent | 07284792d40c556ec4c9e1c92379a922e746e12b (diff) | |
download | gitea-2f725cbc9e836e1d11b8645ee11ed2c82da8c0b7.tar.gz gitea-2f725cbc9e836e1d11b8645ee11ed2c82da8c0b7.zip |
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>
Diffstat (limited to 'docs/content')
-rw-r--r-- | docs/content/doc/advanced/config-cheat-sheet.en-us.md | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md index 741c5f292c..611a7a887a 100644 --- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md +++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md @@ -590,11 +590,12 @@ Define allowed algorithms and their minimum key length (use -1 to disable a type ## Cache (`cache`) - `ENABLED`: **true**: Enable the cache. -- `ADAPTER`: **memory**: Cache engine adapter, either `memory`, `redis`, or `memcache`. -- `INTERVAL`: **60**: Garbage Collection interval (sec), for memory cache only. -- `HOST`: **\<empty\>**: Connection string for `redis` and `memcache`. +- `ADAPTER`: **memory**: Cache engine adapter, either `memory`, `redis`, `twoqueue` or `memcache`. (`twoqueue` represents a size limited LRU cache.) +- `INTERVAL`: **60**: Garbage Collection interval (sec), for memory and twoqueue cache only. +- `HOST`: **\<empty\>**: Connection string for `redis` and `memcache`. For `twoqueue` sets configuration for the queue. - Redis: `redis://:macaron@127.0.0.1:6379/0?pool_size=100&idle_timeout=180s` - Memcache: `127.0.0.1:9090;127.0.0.1:9091` + - TwoQueue LRU cache: `{"size":50000,"recent_ratio":0.25,"ghost_ratio":0.5}` or `50000` representing the maximum number of objects stored in the cache. - `ITEM_TTL`: **16h**: Time to keep items in cache if not used, Setting it to 0 disables caching. ## Cache - LastCommitCache settings (`cache.last_commit`) |