当前位置: 首页>>代码示例>>Java>>正文


Java SimpleKey类代码示例

本文整理汇总了Java中org.springframework.cache.interceptor.SimpleKey的典型用法代码示例。如果您正苦于以下问题:Java SimpleKey类的具体用法?Java SimpleKey怎么用?Java SimpleKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SimpleKey类属于org.springframework.cache.interceptor包,在下文中一共展示了SimpleKey类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Override
@Transactional
public void load(Ehcache ehcache) throws CacheException {
    int i = 1, total = 12;

    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("track", false, false), kmlService.getAllStagesKml("track", false, false), true));
    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("track", false, true), kmlService.getAllStagesKml("track", false, true), true));
    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("track", true, false), kmlService.getAllStagesKml("track", true, true), true));
    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("track", true, true), kmlService.getAllStagesKml("track", true, true), true));

    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("marcadores", false, false), kmlService.getAllStagesKml("marcadores", false, false), true));
    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("marcadores", false, true), kmlService.getAllStagesKml("marcadores", false, true), true));
    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("marcadores", true, false), kmlService.getAllStagesKml("marcadores", true, false), true));
    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("marcadores", true, true), kmlService.getAllStagesKml("marcadores", true, true), true));

    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("servicios", false, false), kmlService.getAllStagesKml("servicios", false, false), true));
    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("servicios", false, true), kmlService.getAllStagesKml("servicios", false, true), true));
    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("servicios", true, false), kmlService.getAllStagesKml("servicios", true, false), true));
    log.info("Caching KML {}/{}...", i++,  total);
    ehcache.put(new Element(new SimpleKey("servicios", true, true), kmlService.getAllStagesKml("servicios", true, true), true));
    log.info("Caching done!");
}
 
开发者ID:jbernach,项目名称:transandalus-backend,代码行数:34,代码来源:KmlBootstrapCacheLoader.java

示例2: getSimple

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Test
public void getSimple() {
	this.keyGenerator.expect(1L);
	Object first = this.simpleService.get(1L);
	Object second = this.simpleService.get(1L);
	assertSame(first, second);

	Object key = new SimpleKey(1L);
	assertEquals(first, cache.get(key).get());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:JCacheKeyGeneratorTests.java

示例3: getFlattenVararg

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Test
public void getFlattenVararg() {
	this.keyGenerator.expect(1L, "foo", "bar");
	Object first = this.simpleService.get(1L, "foo", "bar");
	Object second = this.simpleService.get(1L, "foo", "bar");
	assertSame(first, second);

	Object key = new SimpleKey(1L, "foo", "bar");
	assertEquals(first, cache.get(key).get());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:JCacheKeyGeneratorTests.java

示例4: getFiltered

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Test
public void getFiltered() {
	this.keyGenerator.expect(1L);
	Object first = this.simpleService.getFiltered(1L, "foo", "bar");
	Object second = this.simpleService.getFiltered(1L, "foo", "bar");
	assertSame(first, second);

	Object key = new SimpleKey(1L);
	assertEquals(first, cache.get(key).get());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:JCacheKeyGeneratorTests.java

示例5: generate

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Override
public Object generate(Object target, Method method, Object... params) {
	assertTrue("Unexpected parameters: expected: "
					+ Arrays.toString(this.expectedParams) + " but got: " + Arrays.toString(params),
			Arrays.equals(expectedParams, params));
	return new SimpleKey(params);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:JCacheKeyGeneratorTests.java

示例6: whenFindAllThenBooksCached

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Test
public void whenFindAllThenBooksCached() {
    List<Book> books = bookService.findAll();

    assertThat(books).isNotNull();
    assertThat(bookService.getCounterFindAll()).isEqualTo(1);

    bookService.findAll();
    bookService.findAll();
    assertThat(bookService.getCounterFindAll()).isEqualTo(1);

    Object value = cacheManager.getCache("books").get(SimpleKey.EMPTY);
    assertThat(value).isNotNull();
}
 
开发者ID:sixhours-team,项目名称:memcached-spring-boot,代码行数:15,代码来源:MemcachedCacheIT.java

示例7: whenClearThenOnlyBooksEvicted

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Test
public void whenClearThenOnlyBooksEvicted() {
    bookService.findAll();
    authorService.findAll();

    bookService.clear();

    Object value = cacheManager.getCache("books").get(SimpleKey.EMPTY);
    assertThat(value).isNull();
    value = cacheManager.getCache("authors").get(SimpleKey.EMPTY);
    assertThat(value).isNotNull();
}
 
开发者ID:sixhours-team,项目名称:memcached-spring-boot,代码行数:13,代码来源:MemcachedCacheIT.java

示例8: generate

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Override
public Object generate(Object target, Method method, Object... params) {
	params = ArrayUtils.add(params, 0, method.getName());
	if (params.length == 1) {
		return params[0];
	}
	return new SimpleKey(params);
}
 
开发者ID:easycodebox,项目名称:easycode,代码行数:9,代码来源:MethodArgsKeyGenerator.java

示例9: generateKey

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
/**
 * Generate a key based on the specified parameters.
 */
public static Object generateKey(Object... params) {
    if (params.length == 0) {
        return SimpleKey.EMPTY;
    }
    if (params.length == 1) {
        Object param = params[0];
        if (param != null && Variant.class.isInstance(param)) {
            return generateVariantKey((Variant) param);
        }
    }
    return new SimpleKey(params);
}
 
开发者ID:exomiser,项目名称:Exomiser,代码行数:16,代码来源:VariantKeyGenerator.java

示例10: returnsSimpleKeyForManyThings

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Test
public void returnsSimpleKeyForManyThings() throws Exception {
    Object object1 = new Object();
    Object object2 = new Object();

    assertThat(instance.generate(new Object(), Object.class.getMethod("toString"), object1, object2), equalTo(new SimpleKey(object1, object2)));
}
 
开发者ID:exomiser,项目名称:Exomiser,代码行数:8,代码来源:VariantKeyGeneratorTest.java

示例11: generateKey

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Override
public Object generateKey(Object target, Method method, Object... params) {
    if (params.length == 1) {
        AwsCredentialView param = (AwsCredentialView) params[0];
        if (param.getId() != null) {
            return param.getId();
        } else {
            return SimpleKey.EMPTY;
        }
    }
    return SimpleKey.EMPTY;
}
 
开发者ID:hortonworks,项目名称:cloudbreak,代码行数:13,代码来源:AwsCachingConfig.java

示例12: returnsEmptyKeyForEmptyQuery

import org.springframework.cache.interceptor.SimpleKey; //导入依赖的package包/类
@Test
public void returnsEmptyKeyForEmptyQuery() throws Exception {
    assertThat(instance.generate(new Object(), Object.class.getMethod("toString")), equalTo(SimpleKey.EMPTY));
}
 
开发者ID:exomiser,项目名称:Exomiser,代码行数:5,代码来源:VariantKeyGeneratorTest.java


注:本文中的org.springframework.cache.interceptor.SimpleKey类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。