Some small fixes for different parts of code.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2087 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-09-24 14:57:02 +00:00
commit a5f900f92e
5 changed files with 79 additions and 29 deletions

View file

@ -114,8 +114,18 @@ namespace GreenshotPlugin.Core {
/// <param name="key"></param>
/// <param name="value"></param>
public void Add(TK key, TV value) {
Add(key, value, null);
}
/// <summary>
/// Add a value to the cache
/// </summary>
/// <param name="key"></param>
/// <param name="value"></param>
/// <param name="secondsToExpire?">optional value for the seconds to expire</param>
public void Add(TK key, TV value, int? secondsToExpire) {
lock (lockObject) {
var cachedItem = new CachedItem(key, value, secondsToExpire);
var cachedItem = new CachedItem(key, value, secondsToExpire.HasValue ? secondsToExpire.Value : this.secondsToExpire);
cachedItem.Expired += delegate(TK cacheKey, TV cacheValue) {
if (internalCache.ContainsKey(cacheKey)) {
LOG.DebugFormat("Expiring object with Key: {0}", cacheKey);