-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve #4040
- Loading branch information
Showing
12 changed files
with
924 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
546 changes: 435 additions & 111 deletions
546
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/DistributedCache.cs
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/UnitOfWorkCacheItem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
|
||
namespace Volo.Abp.Caching | ||
{ | ||
[Serializable] | ||
public class UnitOfWorkCacheItem<TValue> | ||
where TValue : class | ||
{ | ||
public bool IsRemoved { get; set; } | ||
|
||
public TValue Value { get; set; } | ||
|
||
public UnitOfWorkCacheItem() | ||
{ | ||
|
||
} | ||
|
||
public UnitOfWorkCacheItem(TValue value) | ||
{ | ||
Value = value; | ||
} | ||
|
||
public UnitOfWorkCacheItem(TValue value, bool isRemoved) | ||
{ | ||
Value = value; | ||
IsRemoved = isRemoved; | ||
} | ||
|
||
public UnitOfWorkCacheItem<TValue> SetValue(TValue value) | ||
{ | ||
Value = value; | ||
IsRemoved = false; | ||
return this; | ||
} | ||
|
||
public UnitOfWorkCacheItem<TValue> RemoveValue() | ||
{ | ||
Value = null; | ||
IsRemoved = true; | ||
return this; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
framework/src/Volo.Abp.Caching/Volo/Abp/Caching/UnitOfWorkCacheItemExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
namespace Volo.Abp.Caching | ||
{ | ||
public static class UnitOfWorkCacheItemExtensions | ||
{ | ||
public static TValue GetUnRemovedValueOrNull<TValue>(this UnitOfWorkCacheItem<TValue> item) | ||
where TValue : class | ||
{ | ||
return item != null && !item.IsRemoved ? item.Value : null; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.