Mercurial > libervia-backend
comparison doc/libervia-cli/pubsub_cache.rst @ 3612:21e7d46b988c
doc (cli/pubsub): document pubsub cache management commands
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 29 Jul 2021 22:51:01 +0200 |
parents | |
children | 23be54db81f1 |
comparison
equal
deleted
inserted
replaced
3611:ce864968fb23 | 3612:21e7d46b988c |
---|---|
1 .. _libervia-cli_pubsub_cache: | |
2 | |
3 ===================================== | |
4 pubsub/cache: PubSub Cache Management | |
5 ===================================== | |
6 | |
7 Libervia runs transparently a cache for pubsub. That means that according to internal | |
8 criteria, some pubsub items are stored locally. | |
9 | |
10 The ``cache`` subcommands let user inspect and manipulate the internal cache. | |
11 | |
12 get | |
13 === | |
14 | |
15 Retrieve items from internal cache only. Most end-users won't need to use this command, as | |
16 the usual ``pubsub get`` command will use cache transparently. However, it may be useful | |
17 to inspect local cache, notably for debugging. | |
18 | |
19 The parameters are basically the same as for :ref:`li_pubsub_get`. | |
20 | |
21 example | |
22 ------- | |
23 | |
24 Retrieve the last 2 cached items for personal blog:: | |
25 | |
26 $ li pubsub cache get -n urn:xmpp:microblog:0 -M 2 | |
27 | |
28 .. _li_pubsub_cache_sync: | |
29 | |
30 sync | |
31 ==== | |
32 | |
33 Synchronise or resynchronise a pubsub node. If the node is already in cache, it will be | |
34 deleted then re-cached. Node will be put in cache even if internal policy doesn't request | |
35 a synchronisation for this kind of nodes. Node will be (re-)subscribed to keep cache | |
36 synchronised. | |
37 | |
38 All items of the node (up to the internal limit which is high), will be retrieved and put | |
39 in cache, even if a previous version of those items have been deleted by the | |
40 :ref:`li_pubsub_cache_purge` command. | |
41 | |
42 | |
43 example | |
44 ------- | |
45 | |
46 Resynchronise personal blog:: | |
47 | |
48 $ li pubusb cache sync -n urn:xmpp:microblog:0 | |
49 | |
50 .. _li_pubsub_cache_purge: | |
51 | |
52 purge | |
53 ===== | |
54 | |
55 Remove items from cache. This may be desirable to save resource, notably disk space. | |
56 | |
57 Note that once a pubsub node is cached, the cache is the source of trust. That means that | |
58 if cache is not explicitly bypassed when retrieving items of a pubsub node (notably with | |
59 the ``-C, --no-cache`` option of :ref:`li_pubsub_get`), only items found in cache will be | |
60 returned, thus purged items won't be used or returned anymore even if they still exists on | |
61 the original pubsub service. | |
62 | |
63 If you have purged items by mistake, it is possible to retrieve them either node by node | |
64 using :ref:`li_pubsub_cache_sync`, or by resetting the whole pubsub cache with | |
65 :ref:`li_pubsub_cache_reset`. | |
66 | |
67 If you have a node or a profile (e.g. a component) caching a lot of items frequently, you | |
68 may use this command using a scheduler like cron_. | |
69 | |
70 .. _cron: https://en.wikipedia.org/wiki/Cron | |
71 | |
72 examples | |
73 -------- | |
74 | |
75 Remove all blog and event items from cache if they haven't been updated since 6 months:: | |
76 | |
77 $ li pubsub cache purge -t blog -t event -b "6 months ago" | |
78 | |
79 Remove items from profile ``ap_gateway`` if they have been created more that 2 months | |
80 ago:: | |
81 | |
82 $ li pubsub cache purge -p ap_gateway --created-before "2 months ago" | |
83 | |
84 .. _li_pubsub_cache_reset: | |
85 | |
86 reset | |
87 ===== | |
88 | |
89 Reset the whole pubsub cache. This means that all nodes and all them items will be removed | |
90 from cache. After this command, cache will be re-filled progressively as if it where a new | |
91 one. | |
92 | |
93 example | |
94 ------- | |
95 | |
96 Reset the whole pubsub cache:: | |
97 | |
98 $ li pubsub cache reset |