|
using System;
using System.Collections.Generic;
namespace LazyLoadSample
{
/// <summary>
/// Good cache implementation using LazyT class.
/// </summary>
public class GoodUsingLazyT : BaseCache
{
private Lazy<IList<Product>> lazyCache;
/// <summary>
/// Initializes a new instance of the GoodUsingLazyT class.
/// </summary>
public GoodUsingLazyT()
{
this.Reset();
}
/// <summary>
/// Gets the products from cache.
/// </summary>
/// <returns>products from cache</returns>
public override IList<Product> GetProducts()
{
return this.lazyCache.Value;
}
/// <summary>
/// Resets the cache.
/// </summary>
public override void Reset()
{
this.lazyCache = new Lazy<IList<Product>>(this.LoadProductsFromDatabase);
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a software developer at CallidusCloud currently working on software for Quoting and Product Configuration.
In past few years I have been working on development of multi-portal CMS and I was responsible for defining Coding standard and Code Review process. For three years, I have lead team of programmers that developed Soprex framework for enterprise applications development and I have also built Soprex Quotation Tool on that framework. My main points of interests are enterprise app architecture, Scrum and TDD.
I blogs about software development at
www.Vukoje.NET.