Class BatchStrategies

java.lang.Object
org.springframework.data.redis.cache.BatchStrategies

public abstract class BatchStrategies extends Object
A collection of predefined BatchStrategy implementations using KEYS or SCAN command.
Since:
2.6
Author:
Mark Paluch, Christoph Strobl
  • Method Details

    • keys

      public static BatchStrategy keys()
      A BatchStrategy using a single KEYS and DEL command to remove all matching keys. KEYS scans the entire keyspace of the Redis database and can block the Redis worker thread for a long time on large keyspaces.

      KEYS is supported for standalone and clustered (sharded) Redis operation modes.

      Returns:
      batching strategy using KEYS.
    • scan

      public static BatchStrategy scan(int batchSize)
      A BatchStrategy using a SCAN cursors and potentially multiple DEL commands to remove all matching keys. This strategy allows a configurable batch size to optimize for scan batching.

      Note that using the SCAN strategy might be not supported on all drivers and Redis operation modes.

      Returns:
      batching strategy using SCAN.