Module: Tasker::CacheCapabilities

Extended by:
ActiveSupport::Concern
Defined in:
lib/tasker/cache_capabilities.rb

Overview

Module for custom cache stores to declare their capabilities

This module provides a clean, developer-friendly API for custom cache store implementations to declare their capabilities explicitly. This enables the CacheStrategy system to make optimal coordination decisions without relying on runtime introspection.

Usage Patterns: 1. Include the module in your custom cache store class 2. Use convenience methods like supports_distributed_caching! 3. Or declare capabilities explicitly with declare_cache_capability

Examples:

Basic usage with convenience methods

class MyAwesomeCacheStore < ActiveSupport::Cache::Store
  include Tasker::CacheCapabilities

  supports_distributed_caching!
  supports_atomic_increment!
  supports_locking!
end

Advanced usage with explicit declarations

class MyCustomCacheStore < ActiveSupport::Cache::Store
  include Tasker::CacheCapabilities

  declare_cache_capability(:distributed, true)
  declare_cache_capability(:atomic_increment, true)
  declare_cache_capability(:locking, false)
  declare_cache_capability(:custom_feature, true)
end

Runtime capability checking

store = MyAwesomeCacheStore.new
store.class.declared_cache_capabilities
# => { distributed: true, atomic_increment: true, locking: true }