• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SimpleKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RetryConstraint类代码示例发布时间:2022-05-22
下一篇:
Java JDBCClient类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap