lruCached method

LruCachedFormix<T, E> lruCached({
  1. int maxSize = 10,
})

Wraps this validator with LRU (Least Recently Used) caching.

Maintains a cache of the most recently validated values. When the cache reaches maxSize, the least recently used entry is evicted.

final cached = emailRule.lruCached(maxSize: 10);

cached.validate('a@example.com'); // Computed, cached
cached.validate('b@example.com'); // Computed, cached
cached.validate('a@example.com'); // Cache hit!

Useful for autocomplete fields or dropdowns with multiple values.

Note: Returns a LruCachedFormix instance with mutable state.

Implementation

LruCachedFormix<T, E> lruCached({int maxSize = 10}) =>
    LruCachedFormix(this, maxSize: maxSize);