CacheDDAPlugin class

DDA plugin that processes @Cacheable and @CacheInvalidate annotations on repository/datasource methods and generates caching wrapper logic.

This plugin is registered automatically when zfa build runs. After the build, call generateCacheFile to emit lib/src/cache/zfa_cache.g.dart.

Supported annotations:

  • @Cacheable(ttl: Duration(hours: 1)) — cache-wrapped method
  • @CacheInvalidate(methods: ['getProduct']) — cache invalidator

The plugin collects metadata about annotated methods and their containing classes, then the CacheGenerator produces:

  • A CacheStore adapter that wraps Hive read/write/TTL logic
  • Wrapper extensions for each @Cacheable method
  • Invalidation hooks for each @CacheInvalidate method
  • DI registration for the generated cache store
Inheritance

Constructors

CacheDDAPlugin({String packageName = 'zuraffa'})

Properties

hasCacheEntries → bool
Whether any cacheable or invalidator methods were collected.
no setter
hashCode → int
The hash code for this object.
no setterinherited
packageName → String
The package name used to build import URIs.
final
priority → int
Priority for ordering when multiple plugins target the same method.
no setteroverride
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
targetDecorator → String
The decorator name this plugin handles, without the @ prefix.
no setteroverride
targetDecorators → List<String>
All decorator names this plugin handles, without the @ prefix.
no setteroverride

Methods

generateCacheFile() → String
Generate the cache layer file content.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
onApply(MethodAST method, DecoratorAST decorator, ZorphyContext context) → void
Called when the AST scanner finds a decorator this plugin handles.
override
onBuildEnd(Map<String, dynamic> config) → void
Optional: called once per build after all files are processed.
inherited
onBuildStart(Map<String, dynamic> config) → void
Optional: called once per build before scanning begins.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited