Skip to content

DarekDan/attribute-based-caching

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

1. What is this?

Cache expensive methods calls with a declarative attribute. No custom code required.

2. Simple Example

[Cache.Cacheable] //this method now cached, will only be called once per guid
public SomeExpensiveObject GetExpensiveObject(Guid userId)
{
..
}

3. Cache with invalidation:

[Cache.Cacheable("UniqueKeyForThisMethod")] //cache using this key plus parameter(s)
public SomeObject GetObjectById(Int32 Id)
{
...
}

[Cache.TriggerInvalidation("UniqueKeyForThisMethod")] //delete from cache using this key and passed parameter(s)
public void RemoveObjectById(Int32 Id)
{
..
} 

More examples can also be found here: http://cascadeofinsights.com/post/1410736927/introducing-attribute-based-caching

4. How does it work

Using postsharp to make method interceptions when a cached version exists

5. More / Press / Blogs

6. Previous Releases (on codeplex)

1.00

  • Original Codeplex Release

1.2

  • faster key generation strategy - thanks payman
  • basic unit tests - thanks payman
  • btree disk cache
  • removed unity dependency
  • simple timetolive setting

1.2.1

  • adding ignoreTTL
  • adding support for colection to KeyBuilder
  • adding deconstructor to btreecache - to clean up open filestream
  • add compile-time reflection cache attribute
  • GitHub version is the most recent version

About

Cache expensive methods calls with a declarative attribute. No custom code required. Configure caching method.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 98.9%
  • Smalltalk 1.1%