Skip to content

Commit

Permalink
add check for existing cache before creating a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenwinship committed Mar 20, 2024
1 parent 91bb468 commit a9b2514
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ public class CacheFactoryBean implements java.io.Serializable {

@PostConstruct
public void init() {
CompleteConfiguration<String, String> config =
new MutableConfiguration<String, String>()
.setTypes( String.class, String.class );
rateLimitCache = manager.createCache(RATE_LIMIT_CACHE, config);
rateLimitCache = manager.getCache(RATE_LIMIT_CACHE);
if (rateLimitCache == null) {
CompleteConfiguration<String, String> config =
new MutableConfiguration<String, String>()
.setTypes( String.class, String.class );
rateLimitCache = manager.createCache(RATE_LIMIT_CACHE, config);
}
}

/**
Expand Down

0 comments on commit a9b2514

Please sign in to comment.