当前位置: 首页 > 软件库 > 数据库相关 > >

CacheManager

授权协议 View license
开发语言 C/C++
所属分类 数据库相关
软件类型 开源软件
地区 不详
投 递 者 薛弘济
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

CacheManager is an open source caching abstraction layer for .NET written in C#. It supports various cache providers and implements many advanced features.

The main goal of the CacheManager package is to make developer's life easier to handle even very complex caching scenarios.
With CacheManager it is possible to implement multiple layers of caching, e.g. in-process caching in front of a distributed cache, in just a few lines of code.

CacheManager is not just an interface to unify the programming model for various cache providers, which will make it very easy to change the caching strategy later on in a project. It also offers additional features, like cache synchronization, concurrent updates, serialization, events, performance counters...The developer can opt-in to those features only if needed.

Build Status

Build Server Status
Windows, MSBuild
Linux, Mono -

CacheManager Nuget Packages

Package Name FullFramework .NET Standard
CacheManager.Core 4.5 2.0
CacheManager.StackExchange.Redis 4.6.1 2.0
CacheManager.SystemRuntimeCaching 4.5 2.0
CacheManager.Microsoft.Extensions.Caching.Memory (4.6.1) 2.0
CacheManager.Microsoft.Extensions.Configuration 4.6.1 2.0
CacheManager.Microsoft.Extensions.Logging (4.6.1) 2.0
CacheManager.Serialization.DataContract 4.5 2.0
CacheManager.Serialization.Bond 4.5 2.0
CacheManager.Serialization.Json 4.5 2.0
CacheManager.Serialization.ProtoBuf 4.5 2.0
CacheManager.Web 4.5 -
CacheManager.Memcached 4.5 -
CacheManager.Couchbase 4.5 2.0

Supported framework targets changed since CacheManager 2.0. In case you have to target .NET 40 for example, you can still use CacheManager 1.x!

Beta Packages

Beta versions of the CacheManager packages are getting pushed to https://www.myget.org/gallery/cachemanager on each build.Add the following feed, if you want to play with the not yet released bits:

https://www.myget.org/F/cachemanager/api/v3/index.json

To find which check-in created which build, use this build history.

Documentation

Documentation can be found on cachemanager.michaco.net:

Generated API documentation is also available.

Blog Posts

CacheManager related blog posts can be found on my website

Examples

Benchmarks

See benchmarks results on GitHub.

List of Features

  • One common interface for handling different caching technologies: ICache<T>
  • Configurable by
    • Code with many different paths and a fluent configuration builder
    • Microsoft.Extensions.Configuration
    • App/Web.config
    • See configuration docs
  • Support for different cache providers
  • Serialization can now be configured.Serialization is only needed in distributed caches. If no additional serialization package is installed and configured, Binary serialization will be used (if available)The following are the currently available serialization options:
    • Binary (build in if the full CLR is being used)
    • Json based on the popular Newtonsoft.Json library
    • Json with Gzip compression
    • Bond based on Microsoft.Bond supporting all three available variants
    • DataContract based on System.Runtime.Serialization library supporting binary, Json & Json with Gzip compression
    • Protocol Buffer Google's protobuf. The package uses Mark's protobuf-net implementation.
  • Update values with lock or transaction for distributed caches.The interfaced provides a simple update method which internally ensures you work with the latest version.And CacheManager handles version conflicts for you.
  • Logging CacheManager comes with an extensible logging API.
    • All standard cache operations are logged
    • Based on log levels more or less information will be logged (try Trace and Debug)
    • Current concrete implementation is based on the ASP.NET Core logging. Other implementation of CacheManager's ILoggerFactory might follow.
  • Strongly typed cache interface.
  • Multiple layersBy having multiple cache handles managed by CacheManager, you can easily implement layered caches. For example, an in process cache in front of your distributed cache, to make read access faster.CacheManager will synchronize those layers for you.
    • Put and Add operations will always be executed on all cache handles registered on the manager.
    • On Get, there are different configuration options defined by CacheUpdateMode, if the item was available in one cache handle:
      • None: No update across the cache handles on Get
      • Up: Updates the handles "above"
      • All: Updates/Adds the item to all handles
  • Expiration: It is possible to configure the expiration per cache handle within the manager or per cache item.The following are the supported expiration modes:
    • Sliding expiration: On cache hit, the cache item expiration timeout will be extended by the configured amount.
    • Absolute expiration: The cache item will expire after the configured timeout.
    • Since 1.0.0, evictions triggered by the cache vendor can trigger events and updates
  • Cache Regions: Even if some cache systems do not support or implement cache regions, the CacheManager implements the mechanism.This can be used to for example group elements and remove all of them at once.
  • Statistics: Counters for all kind of cache actions.
  • Performance Counters: To be able to inspect certain numbers with perfmon, CacheManager supports performance counters per instance of the manager and per cache handle.
  • Event System: CacheManager triggers events for common cache actions:OnGet, OnAdd, OnPut, OnRemove, OnClear, OnClearRegion
    • Events also get triggered by the backplane (if enabled) when multiple instances are sharing the same cache.
    • New OnRemoveByHandle events triggered by actual expiration or memory pressure eviction by the cache vendor
    • Events also get triggered through the backplane and via Redis keyspace events (if configured)
  • System.Web.OutputCache implementation to use CacheManager as OutputCache provider which makes the OutputCache extremely flexible, for example by using a distributed cache like Redis across many web servers.
  • Cache clients synchronization
    • Implemented with the Redis pub/sub feature
  • Supports .Net 4.5, and can be used in cross platform projects with the new .NET Core runtime
  • Spring 的缓存管理器 在 spring 项目中提供了CacheManager接口来定义缓存管理器,这样各个不同的缓存就可以实现它来提供管理器的功能了,在spring-boot-starter-data-redis.jar中自动配置了RedisCacheManager(实现了CacheManager接口),可以通过设置 spring.cache.cache-names 属性在启动时创建其缓存,

  • springboot缓存管理器(CacheManager)讲解——超详细!!! 一、引入 ​随着java的慢慢学习,缓存的使用也越来越多。我们使用缓存大多数是通过api的方式来操作,厉害的人也可以自己自定义注解来简化操作,但是看完这篇博客,以后操作注解就不会辣么麻烦了。因为spring中提供了CacheManager接口和一些注解方便我们来操作。 ​ 在我们接触的缓存大致两种,本地缓存与中间件缓存

  • using System; using System.Collections.Generic; using System.Text; using System.Collections; namespace Library.DataCache { ///  /// 存放要生成静态的数据 ///  public class CacheManager { ///  /// 缓存 ///  private

  • 实际业务开发中,免不了会使用redis作为缓存,加快接口响应速度。一个典型的场景:前端请求到后端服务时,后端服务先查询redis缓存,如果查到则使用缓存数据,否则再查mysql数据库,完后放到redis中。 上面场景一般的实现过程,一般的都是: //1.查询redis //2.判断redis结果是否为空 //3.如果为空,则继续查mysql数据库 //4.mysql的结果放到redis中 //5.

  • GitHub地址:https://github.com/MichaCo/CacheManager CacheManager的优点: 让开发人员的生活更容易处理和配资缓存,即使是非常复杂的缓存方案。 CacheManager能够管理多种缓存,包含 内存, appfabric, redis, couchbase, windows azure cache, memorycache等。 提供了额外的功能,

  • 相关阅读 Spring Cache基础组件 Cache 简介 缓存管理器,管理各种缓存组件; 核心代码 /** * 根据缓存标识符获取缓存 */ @Nullable Cache getCache(String name); /** * 获取此缓存管理器已知的缓存标识符集合 */ Collection<String> getCacheNames(); 实现子类 public interf

  • 为什么要自定义RedisCacheManager CacheManager是对Cache进行管理,创建,获取,销毁等操作的,在创建Cache时,需要对其序列化,如下 public static RedisCacheConfiguration defaultCacheConfig(@Nullable ClassLoader classLoader) { DefaultFormattingConv

  • @Configuration public class RedisCacheManagerConfig { @Bean public RedisCacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) { // 分别创建String和JSON格式序列化对象,对缓存数据key和va

  • 注:作者水平有限,有错误请大佬及时评论纠正,谢谢! 1、首先说一下第一次报错: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 2022-09-04 12:34:51.550 ERROR 8692 --- [

  • 总结 SpringCache定义了@Cacheable、@CachePut、@CacheEvict三个注解,分别对应查询、更新、删除时对缓存的处理 只需要在Server类添加该注解,就可以通过AOP自动代理实现缓存查询、缓存更新、缓存删除,使用形式如下,@Cacheable、@CachePut会在unless条件成立时将返回值添加进缓存,而@Cacheable在有缓存时不会执行Server类方法。

  • 文章目录 实际业务开发中,免不了会使用redis作为缓存,加快接口响应速度。一个典型的场景:前端请求到后端服务时,后端服务先查询redis缓存,如果查到则使用缓存数据,否则再查mysql数据库,完后放到redis中。 上面场景一般的实现过程,一般的都是: //1.查询redis //2.判断redis结果是否为空 //3.如果为空,则继续查mysql数据库 //4.mysql的结果放到redis中

  • Shiro 整合 ehcache 缓存报错: Factory method 'ehCacheCacheManager' threw exception; nested exception is net.sf.ehcache.CacheException: Another CacheManager with same name 'test' already exists in the same VM

  •      * Redis是一个开源的,内存中的数据机构存储系统,它可以作为数据库,缓存和消息中间件。      * 使用:安装redis,引入redis的starter,配置redis      * 原理:CacheManager == Cache 缓存组件来实际给缓存中存取数据,替换默认的SimpleCacheConfiguration      *      1.引入redis的starter

  • 1.redisConfig package com.hc.config.redis; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.annotation.Proper

 相关资料
  • 问题内容: 我没有找到CacheManager bean …但是我没有尝试使用CacheManager做任何事情! 这是我的错误! 这是我的POM.xml,可能是导致此问题的原因。 问题答案: 在上下文文件中,如果使用,IntelliJ会自动导入名称空间而不是名称空间!因此,当我为事务管理器添加标签时,就以为是cacheManager。

  • 我目前正在学习咖啡因,总体来说我对Spring还不熟悉。我一直在尝试用咖啡因实现缓存;然而,我发现自己遇到了几个问题。 我看到了两种配置咖啡因缓存的方法。 首先是Java类: 第二是在应用范围内。财产: 我想问一下,这两者之间有什么不同之处吗?我需要课程和应用程序吗。属性配置,还是仅其中一个?此外,在Java类实现中,cacheManager是仅应用于名为“example”的缓存,还是应用于每个缓

  • 我有一个默认的redis缓存配置在我的application.yml: 它工作得很好,我不想为它创建任何自定义缓存管理器。 然而,在我的代码中有一些缓存不需要使用redis。因此,我想制作第二个CacheManager,它是一个简单的ConcurrentHashMap,并用@Cacheable指定它 为此,我创建了一个新的CacheManager Bean: 这将导致inMemoryCache成为

  • 我试图用两个CacheManager设置一个spring-boot应用程序,代码如下: 但是当我启动应用程序时,它总是失败,出现以下错误: 由:java.lang.IllegalStateException引起:当预期只有1个CachingConfigurer实现时,发现了2个。重构配置,使CachingConfigurer只实现一次或根本不实现。在org.springframework.cach

  • Shiro 有三个重要的缓存接口: CacheManager - 负责所有缓存的主要管理组件,它返回 Cache 实例。 Cache - 维护key/value 对。 CacheManagerAware - 通过想要接收和使用 CacheManager 实例的组件来实现。 CacheManager 返回Cache 实例,各种不同的 Shiro 组件使用这些Cache 实例来缓存必要的数据。任何实现

  • 我的应用程序使用Spring 4.3. x、EhCache 3.6和javax Cache 1.1.0。以下是我在应用程序中配置javax CacheManager的方式: AppCacheManagerFactoryBean(只是JCacheManagerFactoryBean的自定义版本)帮助我为我的应用程序配置全局持久性目录。这是它的外观: 这是我如何定义缓存的。我使用Ehcache API

  • 我知道如何在org中使用xml配置创建CacheManager。ehcache:ehcache:3.8.1: 我还知道如何使用统计服务创建缓存管理器: 但是如何使用统计服务从XML配置创建缓存管理器呢?

  • 我正在使用Ehcache 3 我有一个缓存用于存储一种类型的对象,另一个缓存用于不同类型的对象。这些在不同的类中,每个都有自己的缓存管理器。 但是我现在想知道我是否误解了这些示例,让一个CacheManager管理两个不同的缓存更有意义,或者你只是想使用同一个CacheManager来管理同一类型的多个缓存。 因为示例喜欢将代码链接在一起,所以从留档中很难看出正确的方法是什么。