Items are automatically placed in the appropriate tier based on their size. The cache uses the HeapSize trait to accurately measure memory usage.
The update_channel_size: 1024 is used to configure the capacity of a broadcast channel that notifies subscribers about cache updates. This is implemented using Tokio's broadcast channel.
This channel is used to notify interested parties when values in the cache are updated. Users of the cache can subscribe to these updates using the subscribe_updates() method:
The size of 1024 means that the channel can buffer up to 1024 update notifications before older messages start getting dropped. This is useful in scenarios where you want to monitor or react to cache updates, such as:
If you expect a very high rate of cache updates, you might want to increase this value. Conversely, if you don't need update notifications, you could set it to a smaller value to save memory.