github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/caches/multilevel.md (about) 1 --- 2 title: multilevel 3 type: cache 4 status: stable 5 --- 6 7 <!-- 8 THIS FILE IS AUTOGENERATED! 9 10 To make changes please edit the contents of: 11 lib/cache/multilevel.go 12 --> 13 14 import Tabs from '@theme/Tabs'; 15 import TabItem from '@theme/TabItem'; 16 17 18 Combines multiple caches as levels, performing read-through and write-through 19 operations across them. 20 21 ```yaml 22 # Config fields, showing default values 23 label: "" 24 multilevel: [] 25 ``` 26 27 For the Add command this cache first checks all levels except the last for the 28 key. If the key is not found it is added to the final cache level, if that 29 succeeds all higher cache levels have the key set. 30 31 ## Examples 32 33 It's possible to use multilevel to create a warm cache in memory above a cold 34 remote cache: 35 36 ```yaml 37 pipeline: 38 processors: 39 - branch: 40 processors: 41 - cache: 42 resource: leveled 43 operator: get 44 key: ${! json("key") } 45 - catch: 46 - bloblang: 'root = {"err":error()}' 47 result_map: 'root.result = this' 48 49 cache_resources: 50 - label: leveled 51 multilevel: [ hot, cold ] 52 53 - label: hot 54 memory: 55 ttl: 300 56 57 - label: cold 58 memcached: 59 addresses: [ TODO:11211 ] 60 ttl: 3600 61 ``` 62 63 Using this config when a target key already exists in our local memory cache we 64 won't bother hitting the remote memcached instance. 65