JsonCacheItem.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using System.Text.Json.Serialization;
  2. using CacheManager.Core;
  3. using CacheManager.Core.Internal;
  4. namespace Hotline.CacheManager
  5. {
  6. internal class JsonCacheItem<T> : SerializerCacheItem<T>
  7. {
  8. [JsonConstructor]
  9. public JsonCacheItem()
  10. {
  11. }
  12. public JsonCacheItem(ICacheItemProperties properties, object value) : base(properties, value)
  13. {
  14. }
  15. [JsonPropertyName("createdUtc")]
  16. public override long CreatedUtc { get; set; }
  17. [JsonPropertyName("expirationMode")]
  18. public override ExpirationMode ExpirationMode { get; set; }
  19. [JsonPropertyName("expirationTimeout")]
  20. public override double ExpirationTimeout { get; set; }
  21. [JsonPropertyName("key")]
  22. public override string Key { get; set; }
  23. [JsonPropertyName("lastAccessedUtc")]
  24. public override long LastAccessedUtc { get; set; }
  25. [JsonPropertyName("region")]
  26. public override string Region { get; set; }
  27. [JsonPropertyName("usesExpirationDefaults")]
  28. public override bool UsesExpirationDefaults { get; set; }
  29. [JsonPropertyName("valueType")]
  30. public override string ValueType { get; set; }
  31. [JsonPropertyName("value")]
  32. public override T Value { get; set; }
  33. }
  34. }