Giter Club home page Giter Club logo

abp.csrediscache's People

Contributors

cuizhijiang avatar toolsbyxlg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

abp.csrediscache's Issues

AbpRedisCache.TryGetValue(string key, out object value)遇到的bug

在AbpRedisCache类中的重写方法TryGetValue(string key, out object value)中
按照官方AbpRedisCache类的实现逻辑,如果没有缓存key,则该方法应该将返回值设置为false,并将value设置为null;
但是大佬实现的方法中

 public override bool TryGetValue(string key, out object value)
        {
            try
            {
                value = RedisHelper.Get(GetLocalizedRedisKey(key));
                return true;
            }
            catch
            {
                value = null;
                return false;
            }
        }

默认为只要是没有异常就返回true,这里会导致项目启动获取语言列表的时候如果没有缓存,将null设置到Dictionary中而抛出异常。
将代码改为:

 public override bool TryGetValue(string key, out object value)
        {
            try
            {
                var objbyte  = RedisHelper.Get(GetLocalizedRedisKey(key));
                 value = objbyte != null ? Deserialize(objbyte) : null;
                return objbyte != null;
            }
            catch
            {
                value = null;
                return false;
            }
        }

项目能正常启动,但是我不太确定这种写法有没有其他的隐患,还请大佬指正。

update

大佬,请问你封装这个csredis有跟新的打算吗
还有就是用于项目部署稳定吗,我最近使用abp自己封装的StackExchange.Redis,经常会出现TimeOut的情况,一直找不到原因

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.