Tabnine Logo
VCacheFactory.getStableReadExternalCache
Code IndexAdd Tabnine to your IDE (free)

How to use
getStableReadExternalCache
method
in
com.atlassian.vcache.VCacheFactory

Best Java code snippets using com.atlassian.vcache.VCacheFactory.getStableReadExternalCache (Showing top 9 results out of 315)

origin: com.atlassian.confluence.extra.widgetconnector/widgetconnector

private StableReadExternalCache<String> getCache(String cacheName) {
  return cacheFactory.getStableReadExternalCache(
      cacheName, serializableMarshaller(String.class), new ExternalCacheSettingsBuilder().build()
  );
}
origin: com.atlassian.confluence.plugins/confluence-masterdetail-plugin

@SuppressWarnings("unchecked")
private StableReadExternalCache<ImmutableMap<String, ImmutableList<ImmutableMap<String, PageProperty>>>> createCache(VCacheFactory cacheFactory) {
  return cacheFactory.getStableReadExternalCache(
      CACHE_NAME,
      (Marshaller) serializableMarshaller(ImmutableMap.class),
      new ExternalCacheSettingsBuilder().build()
  );
}
origin: com.atlassian.confluence.extra.widgetconnector/widgetconnector

public TwitterRenderer(I18NBeanFactory i18NBeanFactory, LocaleManager localeManager, VCacheFactory cacheFactory, PageBuilderService pageBuilderService, VelocityRenderService velocityRenderService, HttpRetrievalService httpRetrievalService) {
  this.i18NBeanFactory = i18NBeanFactory;
  this.localeManager = localeManager;
  this.pageBuilderService = pageBuilderService;
  this.velocityRenderService = velocityRenderService;
  this.httpRetrievalService = httpRetrievalService;
  this.cacheRef = Lazy.supplier(() -> cacheFactory.getStableReadExternalCache(
      CACHE_NAME,
      serializableMarshaller(TweetRetrievalResult.class),
      new ExternalCacheSettingsBuilder().build()
  ));
}
origin: com.atlassian.vcache/atlassian-vcache-internal-test

@Test
public void stablereadexternalcache_duplicate_obtain() {
  final StableReadExternalCache<String> firstTime =
      vCacheFactory().getStableReadExternalCache(
          "duplicate", dodgyPair("first"), new ExternalCacheSettingsBuilder().build());
  final CompletionStage<Boolean> put1 = firstTime.put("key", "ignored", PUT_ALWAYS);
  assertThat(VCacheUtils.unsafeJoin(put1), is(true));
  forceNewRequestContext();
  final CompletionStage<Optional<String>> get1 = firstTime.get("key");
  assertThat(VCacheUtils.unsafeJoin(get1), is(Optional.of("first")));
  final StableReadExternalCache<String> secondTime =
      vCacheFactory().getStableReadExternalCache(
          "duplicate", dodgyPair("second"), new ExternalCacheSettingsBuilder().build());
  forceNewRequestContext();
  final CompletionStage<Optional<String>> get2 = secondTime.get("key");
  assertThat(VCacheUtils.unsafeJoin(get2), is(Optional.of("second")));
}
origin: com.atlassian.vcache/atlassian-vcache-internal-test

@Test
public void stableReadExternalCache_normal_marshalling() {
  final ExternalCacheSettings settings = new ExternalCacheSettingsBuilder()
      .defaultTtl(Duration.ofSeconds(60))
      .entryGrowthRateHint(ChangeRate.LOW_CHANGE)
      .dataChangeRateHint(ChangeRate.LOW_CHANGE)
      .entryCountHint(100)
      .build();
  final StableReadExternalCache<String> cache = vCacheFactory().getStableReadExternalCache(
      "my-stable-read-cache", StringMarshalling.pair(), settings);
  assertThat(cache, notNullValue());
  assertThat(cache.getName(), is("my-stable-read-cache"));
  final CompletionStage<Void> rmall = cache.removeAll();
  assertThat(rmall, successful());
  final CompletionStage<Boolean> put1 = cache.put("three", "drei", PUT_ALWAYS);
  assertThat(put1, successfulWith(is(true)));
  final CompletionStage<Optional<String>> get1 = cache.get("three");
  assertThat(get1, successfulWith(is(Optional.of("drei"))));
  assertThat(invocationsOfBegunTxns, is(0));
}
origin: com.atlassian.vcache/atlassian-vcache-internal-test

@Test
public void stableReadExternalCache_normal_marshaller() {
  final ExternalCacheSettings settings = new ExternalCacheSettingsBuilder()
      .defaultTtl(Duration.ofSeconds(60))
      .entryGrowthRateHint(ChangeRate.LOW_CHANGE)
      .dataChangeRateHint(ChangeRate.LOW_CHANGE)
      .entryCountHint(100)
      .build();
  @SuppressWarnings("deprecation")
  final StableReadExternalCache<String> cache = vCacheFactory().getStableReadExternalCache(
      "my-stable-read-cache", MarshallerFactory.stringMarshaller(), settings);
  assertThat(cache, notNullValue());
  assertThat(cache.getName(), is("my-stable-read-cache"));
  final CompletionStage<Void> rmall = cache.removeAll();
  assertThat(rmall, successful());
  final CompletionStage<Boolean> put1 = cache.put("three", "drei", PUT_ALWAYS);
  assertThat(put1, successfulWith(is(true)));
  final CompletionStage<Optional<String>> get1 = cache.get("three");
  assertThat(get1, successfulWith(is(Optional.of("drei"))));
  assertThat(invocationsOfBegunTxns, is(0));
}
origin: com.atlassian.vcache/atlassian-vcache-internal-test

@Test
public void handle_legal_recursive_get_supplier() {
  final ExternalCacheSettings settings = new ExternalCacheSettingsBuilder()
      .defaultTtl(Duration.ofSeconds(60))
      .entryGrowthRateHint(ChangeRate.LOW_CHANGE)
      .dataChangeRateHint(ChangeRate.LOW_CHANGE)
      .entryCountHint(100)
      .build();
  final StableReadExternalCache<String> cache = vCacheFactory().getStableReadExternalCache(
      "my-stable-read-cache", StringMarshalling.pair(), settings);
  final CompletionStage<String> get1 = cache.get("recursive", () ->
      "ignored-" + unsafeJoin(cache.get("recursive", () -> "2")));
  assertThat(get1, successfulWith(is("2")));
}
origin: com.atlassian.vcache/atlassian-vcache-internal-test

  @Test
  public void handle_legal_recursive_get_supplier2() {
    final ExternalCacheSettings settings = new ExternalCacheSettingsBuilder()
        .defaultTtl(Duration.ofSeconds(60))
        .entryGrowthRateHint(ChangeRate.LOW_CHANGE)
        .dataChangeRateHint(ChangeRate.LOW_CHANGE)
        .entryCountHint(100)
        .build();

    final StableReadExternalCache<String> cache = vCacheFactory().getStableReadExternalCache(
        "my-stable-read-cache", StringMarshalling.pair(), settings);

    final CompletionStage<String> get1 = cache.get("recursive", () ->
        unsafeJoin(cache.get("recursive2", () -> "pass")));
    assertThat(get1, successfulWith(is("pass")));
  }
}
origin: com.atlassian.vcache/atlassian-vcache-internal-test

@Test
public void duplicate_names_different_policys() {
  final DirectExternalCache<String> directCache =
      vCacheFactory().getDirectExternalCache(
          "duplicate", StringMarshalling.pair(), new ExternalCacheSettingsBuilder().build());
  thrown.expect(ExternalCacheException.class);
  thrown.expectMessage("Failed due to CREATION_FAILURE");
  final StableReadExternalCache<String> stableCache =
      vCacheFactory().getStableReadExternalCache(
          "duplicate", StringMarshalling.pair(), new ExternalCacheSettingsBuilder().build());
}
com.atlassian.vcacheVCacheFactorygetStableReadExternalCache

Javadoc

Obtains a StableReadExternalCache with the specified details.

Note: each call to this method will return a new instance using the specified settings. However, the existing data stored in the external cache will remain. It is not expected in a production configuration that this method will be called multiple times, but is allowed is a development configuration.

Popular methods of VCacheFactory

  • getDirectExternalCache
    Obtains a DirectExternalCache with the specified details. Note: each call to this method will return
  • getJvmCache
    Obtains a JvmCache with the specified details. Note: multiple calls to this method will always retur
  • getRequestCache
    Obtains a RequestCache with the specified details. Note: multiple calls to this method will always r
  • getTransactionalExternalCache
    Obtains a TransactionalExternalCache with the specified details. Note: each call to this method will

Popular in Java

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now