Skip to content

Commit b8cc4fb

Browse files
committed
DOC: Update documentation about CacheMixin
1 parent 993aeb1 commit b8cc4fb

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
### Configuration
1313

1414
### Core
15+
- `intelmq.lib.mixins.cache.CacheMixin` was extended to support temporary storing messages in a cache queue
16+
(PR#2509 by Kamil Mankowski).
1517

1618
### Development
1719

docs/dev/bot-development.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,26 @@ The `CacheMixin` provides methods to cache values for bots in a Redis database.
197197
- `redis_cache_ttl: int = 15`
198198
- `redis_cache_password: Optional[str] = None`
199199

200-
and provides the methods:
200+
and provides the methods to cache key-value pairs:
201201

202202
- `cache_exists`
203203
- `cache_get`
204204
- `cache_set`
205205
- `cache_flush`
206206
- `cache_get_redis_instance`
207207

208+
and following methods to cache objects in a queue:
209+
210+
- `cache_put`
211+
- `cache_pop`
212+
- `cache_length`.
213+
214+
Caching key-value pairs and queue caching are two separated mechanisms. The first is designed
215+
for arbitrary values, the second one is focused on temporary storing messages (but can handle other
216+
data). You won't see caches from one in the another. For example, if adding a key-value pair using
217+
`cache_set`, it does not change the value from `cache_length`, and if adding an element using
218+
`cache_put` you cannot use `check_exists` to look for it.
219+
208220
### Pipeline Interactions
209221

210222
We can call three methods related to the pipeline:

intelmq/lib/mixins/cache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414

1515
class CacheMixin:
16-
"""Provides caching possibilities for bots
16+
"""Provides caching possibilities for bots, see also https://docs.intelmq.org/latest/dev/bot-development/#mixins
1717
1818
For key-value cache, use methods:
1919
cache_exists

0 commit comments

Comments
 (0)