[go: up one dir, main page]

Skip to content

IEnumerable extension which provides easy frame-based caching.

License

Notifications You must be signed in to change notification settings

isonil/LINQCached

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

About

IEnumerable extension methods which provide easy frame-based object caching.

LinqCache.FramePassed() must be called every frame.

LINQCached caches IEnumerable elements and stores them in a temporary list which it then keeps returning for the next X frames instead of enumerating over the IEnumerable elements over again. This can be useful in the following scenarios:

foreach( var elem in collection
  .Where(x => ExpensiveCheck(x))
  .Cached(60, 0)
  .Where(x => QuickPostCacheCheck(x)) )
{
  // ...
}

It can also be used to cache additional info about the elements:

foreach( var cachedElemInfo in collection
  .Cached(60, 0, x => return new CachedInfo(x)) )
{
  // ...
}

or

foreach( var cachedElemInfo in collection
  .Cached(60, 0, (Foo foo, CachedFoo cachedFoo) => cachedFoo.attribute = ExpensiveFooAttributeCalculation(foo)) )
{
  // ...
}

LINQCached tries to minimize memory allocations.

About

IEnumerable extension which provides easy frame-based caching.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages