Local Cache

The Local Cache plugin provides an in-memory key-value cache within a Linx solution. Use it to avoid repeated calls to external systems — for example, caching settings or reference data that would otherwise require a database query on each use.

The plugin adds a Cache service to your solution. A solution may contain multiple Cache service instances; each operates independently with no shared state. Starting or stopping the service flushes all cached entries.

Cache service properties

Value type

The type of values stored in this cache. Accepts any built-in Linx type or a custom type defined in the solution. All entries in a cache share this type.

Defaults to string.

Expiry

Seconds before a cached entry expires, measured from when the specific entry was set. 0 means entries do not expire.

Defaults to 0.

Note

Stopping and restarting a Cache service clears all entries. Use this as a deliberate flush mechanism.

Service functions

  • TryGet: Retrieves a value from the cache by key. Returns a result object with a WasFound flag and the cached Value.

  • Set: Stores a value in the cache. Overwrites any existing entry with the same key.

  • Remove: Removes a cached entry by key. No error is raised if the key does not exist.

Last updated