Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Jarlotee/xCache.Redis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xCache.Redis

This libarary extends xCache to use Redis as the underlying store.

Installation

The library is available on nuget

install-package xCache.Redis

Usage

Register your preffered caching service to the ICache interface through your DI container.

	//Register	
	Ioc.RegisterInstance<IConnectionMultiplexer>(ConnectionMultiplexer.Connect("localhost"));
	Ioc.RegisterInstance<IRedisValueSerializer>(new JsonRedisValueSerializer());
	Ioc.RegisterType<ICache, xCache.Redis.RedisCache>();

Resolve ICache and handle your caching needs

	
	var cache = Ioc.Resolve<ICache>();
	var key = "testKey";
	
	var result = cache.Get<string>(key);
	
	if(result == null)
	{
		result = GetResult();
		
		//Cache for 5 minutes
		cache.Add<string>(key, result, new Timespan(0,5,0));
	}

Aop

xCache.Redis is compliant with Aspect oriented programming (Aop)

See the xCache readme for more information.

Version

0.2.1

Please note that [email protected] is only compatible with the [email protected]

License

MIT

About

Method level caching using Redis

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published