Add ability to remove keys by type or API call#85
Add ability to remove keys by type or API call#85porunov wants to merge 1 commit intofalcondev-oss:devfrom
Conversation
1a0d5d8 to
6db0282
Compare
6db0282 to
8363583
Compare
8363583 to
e940ac8
Compare
|
@LouisHaftmann @DrJume let me know if you think these features are viable or you would prefer seeing it differently. Thank you! |
e940ac8 to
922234e
Compare
Fixes falcondev-oss#79 Partially related to falcondev-oss#74 Signed-off-by: Oleksandr Porunov <alexandr.porunov@gmail.com>
922234e to
6840204
Compare
| If enabled then any specifically structured keys will be automatically removed if there are more keys of such type than | ||
| the amount specified via `MAX_STORED_KEYS_PER_TYPE`. | ||
| Key type is defined by the following format: | ||
| `{key_type}{TYPED_KEY_DELIMITER}{optional custom string}` |
There was a problem hiding this comment.
What is the purpose of the optional custom string?
There was a problem hiding this comment.
This should probably take the same params as the GET _apis/artifactcache/cache route:
- keys
- optional version
I would also prefer a route name like /extra/caches/prune
There was a problem hiding this comment.
Instead of adding more functions for the different methods of pruning caches, I would just add filter functionality to the existing pruneCaches function. This file now also has many untyped functions which should be avoided.
| If `ENABLE_TYPED_KEY_PREFIX_REMOVAL` is `true` then this is the maximum amount of the most recent keys to keep per key type. | ||
| Any other older keys will be automatically removed. | ||
|
|
||
| #### `TYPED_KEY_DELIMITER` |
There was a problem hiding this comment.
I believe cache keys cannot contain , so we could just use it as a delimiter
This PR adds keys eviction strategy by specified keys "type" (key prefix).
Additionally, this PR adds a custom endpoint which can be used to clear all keys associated with specific prefix (useful for PR closing events or other types of events which indicate that some keys won't be used anymore).
This functionality was tested manually on self-hosted GitHub runners.
Migration is not needed for these features to work.
See updated documentation for more information: docs/content/1.getting-started/1.index.md
Fixes #79
Partially related to #74