Search documentation of Metastatic

# Metastatic.Semantic.Domains.Cache (Metastatic v0.13.2)

View Source

Cache operation patterns for semantic enrichment.

This module defines patterns for detecting cache operations across multiple languages and caching libraries. Patterns are registered with the `Metastatic.Semantic.Patterns` registry at module load time.

## Supported Libraries

### Elixir

- Cachex - In-memory cache with TTL support
- ConCache - ETS-based caching
- Nebulex - Distributed caching
- ETS - Erlang Term Storage

### Python

- redis-py - Redis client
- python-memcached - Memcached client
- Flask-Caching - Flask caching extension
- django-cache - Django caching framework

### Ruby

- Rails.cache - Rails caching API
- Dalli - Memcached client
- redis-rb - Redis client

### JavaScript

- node-cache - In-memory caching
- redis/ioredis - Redis clients
- memcached - Memcached client

## Cache Operations

Operation | Description
--- | ---
`:get` | Retrieve value from cache
`:set` | Store value in cache
`:delete` | Remove value from cache
`:clear` | Clear all cache entries
`:invalidate` | Invalidate cache entries
`:expire` | Set/update TTL
`:exists` | Check if key exists
`:increment` | Increment numeric value
`:decrement` | Decrement numeric value
`:ttl` | Get time-to-live
`:fetch` | Get or compute value

## Pattern Structure

Each pattern is a tuple of `{pattern, spec}` where:

- `pattern` - String or Regex to match function names
- `spec` - Map with operation details:
  - `:operation` - The cache operation type
  - `:framework` - The caching library identifier
  - `:extract_target` - Strategy for extracting cache key

## Summary

### Functions

register_all()

Registers all cache patterns for all languages.

## Functions

# register_all()

    @spec register_all() :: :ok

Registers all cache patterns for all languages.

Called automatically when the module is loaded. Can also be called manually to re-register patterns (e.g., after clearing).