Skip to content

Commit

Permalink
Renamed from ObjectItem to Cacheableitem
Browse files Browse the repository at this point in the history
  • Loading branch information
kubagdynia committed Nov 29, 2023
1 parent 5fc4c8d commit fe950a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace CacheDrive.Models;

public class ObjectItem<T> : ICacheable
public class CacheableItem<T> : ICacheable
{
[JsonPropertyName("key")]
public string Key { get; set; }
Expand All @@ -17,6 +17,6 @@ public string CacheKey
public static string GetCacheKey(string key)
=> $"{typeof(T).Name.ToLower()}@{key}";

public static ObjectItem<T> Create(string key, T value)
public static CacheableItem<T> Create(string key, T value)
=> new() { Key = key, Value = value };
}
6 changes: 3 additions & 3 deletions CacheDrive/Services/MemoryCacheService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public bool HasItem(string key)

public bool TryGetValue<T>(string key, out T value)
{
if (TryGetCacheableValue(key, out ObjectItem<T> result))
if (TryGetCacheableValue(key, out CacheableItem<T> result))
{
if (result == null)
{
Expand Down Expand Up @@ -81,7 +81,7 @@ public bool TryGetValue<T>(string key, out T value)

public async Task<T> GetAsync<T>(string key)
{
ObjectItem<T> cachedItem = await GetCacheableAsync<ObjectItem<T>>(key);
CacheableItem<T> cachedItem = await GetCacheableAsync<CacheableItem<T>>(key);

if (cachedItem is null)
{
Expand Down Expand Up @@ -128,7 +128,7 @@ public async Task<T> GetAsync<T>(string key)

public Task SetAsync<T>(string key, T value, int expirySeconds = 0)
{
return SetAsync(ObjectItem<T>.Create(key, value), expirySeconds);
return SetAsync(CacheableItem<T>.Create(key, value), expirySeconds);
}

public Task SetAsync<T>(T item, int expirySeconds = 0) where T : ICacheable
Expand Down

0 comments on commit fe950a9

Please sign in to comment.