You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using ff4j-spring-boot-starter with f4j-store-springjdbc to setup my ff4j server. All my other microservices use the endpoints given by ff4j to access this feature store and the response is returned in JSON.
Since the data does not change that often and we are trying to save unnecessary database calls, I am trying to cache my feature store on the server. Also, if the feature flag DB is down (for refresh/maintenance) we still want the other services to successfully start-up using these values from the cache.
Our FeatureCacheProviderEhCache implementation looks like this in FF4jConfig.java looks like this.
@ConditionalOnClass({ ConsoleServlet.class, FF4jDispatcherServlet.class })
public class Ff4jConfig extends SpringBootServletInitializer {
@Autowired
private DataSource dataSource;
@Bean
public ServletRegistrationBean<FF4jDispatcherServlet> ff4jDispatcherServletRegistrationBean(
FF4jDispatcherServlet ff4jDispatcherServlet) {
ServletRegistrationBean<FF4jDispatcherServlet> bean = new ServletRegistrationBean<FF4jDispatcherServlet>(
ff4jDispatcherServlet, "/web-console/*");
bean.setName("ff4j-console");
bean.setLoadOnStartup(1);
return bean;
}
@Bean
@ConditionalOnMissingBean
public FF4jDispatcherServlet getFF4jDispatcherServlet() {
FF4jDispatcherServlet ff4jConsoleServlet = new FF4jDispatcherServlet();
ff4jConsoleServlet.setFf4j(getFF4j());
return ff4jConsoleServlet;
}
@Bean
public FF4j getFF4j() {
FF4j ff4j = new FF4j();
FF4JCacheManager cacheManager = new FeatureCacheProviderEhCache();
ff4j.setPropertiesStore(new PropertyStoreSpringJdbc(dataSource));
ff4j.setFeatureStore(new FeatureStoreSpringJdbc(dataSource));
ff4j.setEventRepository(new EventRepositorySpringJdbc(dataSource));
ff4j.cache(cacheManager);
// Enable audit mode
ff4j.audit(true);
return ff4j;
}
}
WebConsole reflects the database changes as soon as they are commit and it does not seem like the cache is being hit or that the cache is storing any of the data in it.
I want to be able to use this cache without going to database for every single lookup.
We also tried using InMemoryCacheManager as an alternate to FeatureCacheProviderEhCache, but same results. We do see the clear cache button on our web-console in both the implementations.
Also, is there a better way for me to test if my api calls are actually getting data from cache and not from db, without having to shutdown the db?
The text was updated successfully, but these errors were encountered:
I am using
ff4j-spring-boot-starter
withf4j-store-springjdbc
to setup my ff4j server. All my other microservices use the endpoints given by ff4j to access this feature store and the response is returned in JSON.Since the data does not change that often and we are trying to save unnecessary database calls, I am trying to cache my feature store on the server. Also, if the feature flag DB is down (for refresh/maintenance) we still want the other services to successfully start-up using these values from the cache.
We imported
ff4j-store-ehcache
in our pom.xmlOur FeatureCacheProviderEhCache implementation looks like this in FF4jConfig.java looks like this.
WebConsole reflects the database changes as soon as they are commit and it does not seem like the cache is being hit or that the cache is storing any of the data in it.
I want to be able to use this cache without going to database for every single lookup.
We also tried using InMemoryCacheManager as an alternate to FeatureCacheProviderEhCache, but same results. We do see the clear cache button on our web-console in both the implementations.
Also, is there a better way for me to test if my api calls are actually getting data from cache and not from db, without having to shutdown the db?
The text was updated successfully, but these errors were encountered: