Java Code Examples for com.github.benmanes.caffeine.cache.Ticker#systemTicker()

The following examples show how to use com.github.benmanes.caffeine.cache.Ticker#systemTicker() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CacheConfiguration.java    From GreenSummer with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Bean
/**
 * The ticker bean, in case you have to do something time based in the cache manager
 *
 * @return the ticker bean
 */
public Ticker ticker() {
    return Ticker.systemTicker();
}
 
Example 2
Source File: DefaultMessageDistributorTest.java    From metron with Apache License 2.0 5 votes vote down vote up
@BeforeEach
public void setup() throws Exception {

  context = Context.EMPTY_CONTEXT();
  JSONParser parser = new JSONParser();
  messageOne = (JSONObject) parser.parse(inputOne);
  messageTwo = (JSONObject) parser.parse(inputTwo);

  distributor = new DefaultMessageDistributor(
          periodDurationMillis,
          profileTimeToLiveMillis,
          maxNumberOfRoutes,
          Ticker.systemTicker());
}
 
Example 3
Source File: CacheBuilderTest.java    From caffeine with Apache License 2.0 5 votes vote down vote up
public void testTicker_setTwice() {
  Ticker testTicker = Ticker.systemTicker();
  Caffeine<Object, Object> builder =
      Caffeine.newBuilder().ticker(testTicker);
  try {
    // even to the same instance is not allowed
    builder.ticker(testTicker);
    fail();
  } catch (IllegalStateException expected) {}
}
 
Example 4
Source File: AbstractOAuth2TokenService.java    From cloud-security-xsuaa-integration with Apache License 2.0 4 votes vote down vote up
public AbstractOAuth2TokenService() {
	this(TokenCacheConfiguration.defaultConfiguration(), Ticker.systemTicker(), false);
}
 
Example 5
Source File: CaffeineCacheConfiguration.java    From Groza with Apache License 2.0 4 votes vote down vote up
@Bean
public Ticker ticker() {
    return Ticker.systemTicker();
}
 
Example 6
Source File: DefaultMessageDistributor.java    From metron with Apache License 2.0 3 votes vote down vote up
/**
 * Create a new message distributor.
 *
 * @param periodDurationMillis The period duration in milliseconds.
 * @param profileTimeToLiveMillis The time-to-live of a profile in milliseconds.
 * @param maxNumberOfRoutes The max number of unique routes to maintain.  After this is exceeded, lesser
 *                          used routes will be evicted from the internal cache.
 */
public DefaultMessageDistributor(
        long periodDurationMillis,
        long profileTimeToLiveMillis,
        long maxNumberOfRoutes) {
  this(periodDurationMillis, profileTimeToLiveMillis, maxNumberOfRoutes, Ticker.systemTicker());
}
 
Example 7
Source File: AbstractOAuth2TokenService.java    From cloud-security-xsuaa-integration with Apache License 2.0 2 votes vote down vote up
/**
 * Constructor used to overwrite the default cache configuration.
 *
 * @param tokenCacheConfiguration
 *            the cache configuration used to configure the cache.
 */
public AbstractOAuth2TokenService(TokenCacheConfiguration tokenCacheConfiguration) {
	this(tokenCacheConfiguration, Ticker.systemTicker(), false);

}