src/Library/NetPro.RedisManager/NullCache.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace NetPro.RedisManager
{
    [Obsolete]
    internal class NullCache : IRedisManager
    {
        public IDatabase Database => throw new NotSupportedException();

        public NullCache()
        {
            Console.WriteLine("redis drive is null");
        }
        public T Get<T>(string key)
        {
            return default(T);
        }

        public bool Set(string key, string data, int expiredTime = -1)
        {
            return false;
        }

        public Task<bool> SetAsync(string key, string data, int expiredTime = -1)
        {
            return default;
        }

        public Task<T> GetAsync<T>(string key)
        {
            return default;
        }

        public T GetOrSet<T>(string key, Func<T> func = null, int expiredTime = -1, int localExpiredTime = 0)
        {
            Common.CheckAndProcess(ref key, ref expiredTime);

            if (func == null)
                return default(T);
            var executeResult = func.Invoke();
            return executeResult;
        }

        public async Task<T> GetOrSetAsync<T>(string key, Func<Task<T>> func = null, int expiredTime = -1, int localExpiredTime = 0)
        {
            Common.CheckAndProcess(ref key, ref expiredTime);
            if (func == null)
                return default(T);
            var executeResult = await func.Invoke();
            return executeResult;
        }

        public object GetByLuaScript(string script, object obj)
        {
            return default;
        }

后面还有 287 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。