For the complete documentation index, see llms.txt. This page is also available as Markdown.

Cache Providers

Register custom cache providers in your BoxLang module (Java only)

Cache providers enable custom caching backends (Redis, Couchbase, custom stores) for BoxLang's caching system.

Creating a Cache Provider

Implement the ICacheProvider interface and register via ServiceLoader:

File: src/main/java/ortus/boxlang/modules/mymodule/cache/MyCacheProvider.java

import ortus.boxlang.runtime.cache.providers.ICacheProvider;
import ortus.boxlang.runtime.scopes.Key;

public class MyCacheProvider implements ICacheProvider {

    @Override
    public Key getName() {
        return Key.of( "MyCache" );
    }

    @Override
    public void configure( IStruct config ) {
        // Configure provider from settings
    }

    @Override
    public Object get( Key key ) {
        // Retrieve from your cache
    }

    @Override
    public void put( Key key, Object value, Long timeout ) {
        // Store in your cache
    }

    @Override
    public void clear( Key key ) {
        // Remove from your cache
    }

    // ... other ICacheProvider methods
}

ServiceLoader Config: src/main/resources/META-INF/services/ortus.boxlang.runtime.cache.providers.ICacheProvider

Usage

Once registered, users can configure your cache provider in boxlang.json:

Next Steps

  • Services — Global runtime services (Java only)

  • Schedulers — Scheduled task management (Java only)

  • JDBC Drivers — Database driver registration (Java only)

Last updated

Was this helpful?