Skip to content

When using Jcache extension, add a way to provide an Executor factory in TypeSafe's Config to populate CaffeineConfiguration #276

@phylexx

Description

@phylexx

When using the Jcache extension and loading Caffeine using the CachingProvider SPI implementation (CaffeineCachingProvider), the cache is easily setup and configured. But the TypeSafe's config does not provide any way to use a dedicated Executor instead of the ForkJoinPool used by default in CaffeineConfiguration.
Which means, to set up a custom Executor, one cannot use the SPI, but needs to manually assemble the pieces and eagerly load the caches as follow :

  • load the TypeSafe's Config (ConfigFactory.load())
  • call the CacheManagerImpl constructor passing the loaded Config
  • iterate over all caches defined in the config to call CacheManagerImpl.createCache with the tuned CaffeineConfiguration built from TypesafeConfigurator.from method.

I may have missed something, but it would be easier if we could specify in the TypeSafe's config :

  • an Executor factory (which could be provided by a Dependency Injection Framework)
  • or some kind of customizer/initializer class which could be called to customize the CaffeineConfiguration before instantiating caches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions