Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions FastCache/FastCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void AddOrUpdate(TKey key, TValue value, TimeSpan ttl)
{
var ttlValue = new TtlValue(value, ttl);

_dict.AddOrUpdate(key, ttlValue, (k, v) => ttlValue);
_dict.AddOrUpdate(key, (k, c) => c, (k, v, c) => c, ttlValue);
}

/// <summary>
Expand Down Expand Up @@ -153,7 +153,7 @@ public TValue GetOrAdd(TKey key, Func<TKey, TValue> valueFactory, TimeSpan ttl)
if (TryGet(key, out var value))
return value;

return _dict.GetOrAdd(key, (k, v) => new TtlValue(valueFactory(k), v), ttl).Value;
return _dict.GetOrAdd(key, (k, v) => new TtlValue(v.valueFactory(k), v.ttl), (ttl, valueFactory)).Value;
}

/// <summary>
Expand Down