Redaguoti

Bendrinti naudojant


Use Redis modules with Azure Cache for Redis

With Azure Cache for Redis, you can use Redis modules as libraries to add more data structures and functionality to the core Redis software. You add the modules at the time you're creating your Enterprise tier cache.

For more information on creating an Enterprise cache, see Quickstart: Create a Redis Enterprise cache.

Modules were introduced in open-source Redis 4.0. The modules extend the use-cases of Redis by adding functionality like search capabilities and data structures like bloom and cuckoo filters.

Scope of Redis modules

Some popular modules are available for use in the Enterprise tier of Azure Cache for Redis:

Module Basic, Standard, and Premium Enterprise Enterprise Flash
RediSearch No Yes Yes (preview)
RedisBloom No Yes No
RedisTimeSeries No Yes No
RedisJSON No Yes Yes

Note

Currently, you can't manually load any modules into Azure Cache for Redis. Manually updating modules version is also not possible.

Using modules with active geo-replication

Only the RediSearch and RedisJSON modules can be used concurrently with active geo-replication.

Using these modules, you can implement searches across groups of caches that are synchronized in an active-active configuration. Also, you can search JSON structures in your active-active configuration.

Client library support

The standard Redis client libraries have a varying amounts of support for each module. Some modules have specific libraries that add client support. Check the Redis documentation pages for each module to see more detail on which client libraries support them.

Adding modules to your cache

You must add modules when you create your Enterprise tier cache. To add a module or modules when creating a new cache, use the settings in the Advanced tab of the Enterprise tier caches.

You can add all the available modules or to select only specific modules to install.

Screenshot of advanced tab showing a list of modules to add to a new cache.

Important

Modules must be enabled at the time you create an Azure Cache for Redis instance.

For more information, see Quickstart: Create a Redis Enterprise cache.

Modules

The following modules are available when creating a new Enterprise cache.

RediSearch

The RediSearch module adds a real-time search engine to your cache combining low latency performance with powerful search features.

Features include:

  • Multi-field queries
  • Aggregation
  • Prefix, fuzzy, and phonetic-based searches
  • Auto-complete suggestions
  • Geo-filtering
  • Boolean queries

Additionally, RediSearch can function as a secondary index, expanding your cache beyond a key-value structure and offering more sophisticated queries.

RediSearch also includes functionality to perform vector similarity queries such as K-nearest neighbor (KNN) search. This feature allows Azure Cache for Redis to be used as a vector database, which is useful in AI use-cases like semantic answer engines or any other application that requires the comparison of embeddings vectors generated by machine learning models.

You can use RediSearch is used in a wide variety of use-cases, including real-time inventory, enterprise search, and in indexing external databases. For more information, see the RediSearch documentation page.

Important

The RediSearch module requires use of the Enterprise clustering policy and the NoEviction eviction policy. For more information, see Clustering on Enterprise and Memory Policies

RedisBloom

RedisBloom adds four probabilistic data structures to a Redis server: bloom filter, cuckoo filter, count-min sketch, and top-k. Each of these data structures offers a way to sacrifice perfect accuracy in return for higher speed and better memory efficiency.

Data structure Description Example application
Bloom and Cuckoo filters Tells you if an item is either (a) definitely not in a set or (b) potentially in a set. Checking if an email has already been sent to a user
Count-min sketch Determines the frequency of events in a stream Counting how many times an IoT device reported a temperature under 0 degrees Celsius.
Top-k Finds the k most frequently seen items Determine the most frequent words used in War and Peace. (for example, setting k = 50 returns the 50 most common words in the book)

Bloom and Cuckoo filters are similar to each other, but each has a unique set of advantages and disadvantages that are beyond the scope of this documentation.

For more information, see RedisBloom.

RedisTimeSeries

The RedisTimeSeries module adds high-throughput time series capabilities to your cache. This data structure is optimized for high volumes of incoming data and contains features to work with time series data, including:

  • Aggregated queries (for example, average, maximum, standard deviation, etc.)
  • Time-based queries (for example, start-time and end-time)
  • Downsampling/decimation
  • Data labeling for secondary indexing
  • Configurable retention period

This module is useful for many applications that involve monitoring streaming data, such as IoT telemetry, application monitoring, and anomaly detection.

For more information, see RedisTimeSeries.

RedisJSON

The RedisJSON module adds the capability to store, query, and search JSON-formatted data. This functionality is useful for storing document-like data within your cache.

Features include:

  • Full support for the JSON standard
  • Wide range of operations for all JSON data types, including objects, numbers, arrays, and strings
  • Dedicated syntax and fast access to select and update elements inside documents

The RedisJSON module is also designed for use with the RediSearch module to provide integrated indexing and querying of data within a Redis server. Using both modules together can be a powerful tool to quickly retrieve specific data points within JSON objects.

Some common use-cases for RedisJSON include applications such as searching product catalogs, managing user profiles, and caching JSON-structured data.

For more information, see RedisJSON.

Note

The FT.CONFIG command is not supported for updating module configuration parameters. However, this can be achieved by passing in arguments configuring the modules when using management APIs. For instance, you can see samples of configuring the ERROR_RATE and INITIAL_SIZE properties of the RedisBloom module using the args parameter with the REST API, Azure CLI, or PowerShell.