Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InMemory ¶
type InMemory struct { Options Options // contains filtered or unexported fields }
InMemory is an in-memory `cache.Backend`.
func New ¶
New creates a new in-memory `cache.Backend` implementation with the supplied options. Note that this starts a go-routine to evict expired items from the cache. This go-routine is terminated when the context is cancelled.
type Option ¶
Option is a functional argument that configures the Options.
func WithCacheOptions ¶
WithCacheOptions specifies the options for the underlying cache. Note: multiple instances are appended, so `New(ctx, WithCacheOptions(opt1, opt2))` is the same as `New(ctx, WithCacheOptions(opt1), WithCacheOptions(opt2))`.
func WithExpiration ¶
WithExpiration specifies the time-to-live for specific items that are added to the cache. This is the same as: `WithItemOptions(cache.WithExpiration(expiration))`.
func WithItemOptions ¶
func WithItemOptions(opts ...cache.ItemOption) Option
WithItemOptions specifies the options for the underlying cache for each specific item that is added. Note: multiple instances are appended, so `New(ctx, WithItemOptions(opt1, opt2))` is the same as `New(ctx, WithItemOptions(opt1), WithItemOptions(opt2))`.
type Options ¶
type Options struct { CacheOptions []cache.Option[string, *llms.ContentResponse] ItemOptions []cache.ItemOption }
Options is a set of options for the in-memory cache.