Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetByPrefix method on IHybridCache #388

Open
umar-ulabs opened this issue Jul 22, 2022 · 5 comments
Open

GetByPrefix method on IHybridCache #388

umar-ulabs opened this issue Jul 22, 2022 · 5 comments

Comments

@umar-ulabs
Copy link

I am in dare need of the GetByPrefix method on IHybridCache, how can I add it back. I learned it was removed from 0.5 version. Please help.

@catcherwong
Copy link
Member

@umar-ulabs Thanks for your interest in this project.

Could you show us why you need this method on IHybridCache?

@umar-ulabs
Copy link
Author

IEasyCachingProvider has a method "GetByPrefixAsync" but IHybridCachingProvider doesn't. Since I am using IHybridCachingProvider as layered(in memory and redis) caching, I had to change the core feature of my application. I had read somewhere that there was "GetByPrefixAsync" on IHybridCachingProvider interface but was remove in version 0.5 or something. Is there a way to bring it back?

@catcherwong
Copy link
Member

After v0.5.0, IHybridCachingProvider was redesigned and we have found that few people have a demand for this method, so we remove it.

BTW, in design, if the local cache hits, the result is directly returned.

If the prefix is used to obtain the data, it should be considered that if the number of local caches is less than the number of distributed caches, incomplete data may be obtained at this time.

@umar-ulabs
Copy link
Author

for now I am just getting items one by one, I hope it doesn't cause any problems
`
var items = new List();

        foreach (var key in keys)
        {
            var data = await _cacheManager.GetAsync<V>(key);
            if (data != null && data.Value != null)
            {
                items.Add(data.Value);
            }
        }
        return items;`

@robert94p
Copy link

I need this method. It is necessary to obtain all data stored with a specific prefix in the key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants