Skip to content

Add support for caching using PSR-6 #141

@JasonTheAdams

Description

@JasonTheAdams

There are moments where Providers will want to cache results and not make a request every time. An example of this is that our current Provider implementations request the list of models for every fulfilled prompt. This means every prompt is at least two round trips when it could be one in subsequent calls.

We should implement the PSR-6 interfaces to make this work. This allows any system implementing this to provide its own caching layer.

I did consider the PSR-16 route, especially since maps pretty well to the wp_cache_* functions in WordPress, for us in the WP AI Client, but in the spirit of keeping this more framework agnostic, I think we should use PSR-6. It's really not much more complex, but allows for more verbose caching systems.

Metadata

Metadata

Assignees

Labels

[Feature]New feature to highlight in changelogs.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions