By default, Upstash will reject write operations once the maximum data size limit has been reached. However, if you are utilizing Upstash as a cache, you have the option to enable eviction. Enabling eviction allows older data to be automatically removed from the cache (including Durable Storage) when the maximum size limit is reached. This ensures that the cache remains within the allocated size and can make room for new data to be stored. Enabling eviction is particularly useful when the cache is intended to store frequently changing or temporary data, allowing the cache to adapt to evolving data needs while maintaining optimal performance.

  • You can enable eviction by checking Eviction checkbox while creating a new database:

  • Or for an existing database by clicking Enable in Configuration/Eviction box in the database details page:

Upstash currently uses a single eviction algorithm, called optimistic-volatile, which is a combination of volatile-random and allkeys-random eviction policies available in the original Redis.

Initially, Upstash employs random sampling to select keys for eviction, giving priority to keys marked with a TTL (expire field). If there is a shortage of volatile keys or they are insufficient to create space, additional non-volatile keys are randomly chosen for eviction. In future releases, Upstash plans to introduce more eviction policies, offering users a wider range of options to customize the eviction behavior according to their specific needs.