-
Notifications
You must be signed in to change notification settings - Fork 14
Caching
Arun Prakash edited this page Sep 21, 2025
·
2 revisions
Speed up repeated GET calls with a simple readβthrough/writeβthrough cache.
final client = WordpressClient(
baseUrl: Uri.parse('https://example.com/wp-json/wp/v2'),
bootstrapper: (b) => b
.withCache(
ttl: const Duration(minutes: 5), // default: 1 minute
// cache: MyCustomCacheManager(), // optional custom store
// clearOnWrite: false, // keep cache on POST/PUT/DELETE
)
.build(),
);
- Applies to GET endpoints (list/retrieve/custom GET).
- Default store is inβmemory. Provide your own by implementing
ICacheManager<WordpressRawResponse>
. - After a successful write (POST/PUT/PATCH/DELETE), cache is cleared by default to avoid stale data. Toggle via
clearOnWrite
.
class MyStore implements ICacheManager<WordpressRawResponse> {
// implement put/get/evict/clear as needed
}
Pair caching with the
ParallelWordpress
features for very fast, paginated reads.
- π Welcome to our Wiki!
- π Usage
- π Using Custom Requests
- π‘ Authorization
- π Supported REST Methods
- π API Changelog
- π Middlewares
- π« Parallel Requests
- π§© Interfaces & Extensions
- π‘οΈ Error Handling & Responses
- βοΈ Bootstrap & Configuration
- π Events & Statistics
- π Pagination & Finders