Comments (8)
You are using V2.6.3. Please update it to 2.6.4, because it considers ConstantExpression
value's in final hash. In this case you won't see the same cache-keys.
from efsecondlevelcache.core.
I tested your ext method and it works fine (creates 2 different cache-keys for 2 different inputs):
from efsecondlevelcache.core.
Note that the Id property is located on an aggregate base class and inherited by other classes, if it matters in any way.
from efsecondlevelcache.core.
I can't reproduce it. Try this sample.
Using 2 different parameters will create 2 different cache-keys with different results from the cache:
from efsecondlevelcache.core.
Indeed. Here is my sample for three different values for Id parameter. It generates three different records in Redis but all of them referencing the same hash.
Records:
from efsecondlevelcache.core.
You are right. my bad. updating to 2.64. fixes the issue for cases where I directly use DbContext.
If I use some extension methods on DbContext to get some form of a repository pattern,
I'm stuck again. But I guess that's some misuse on my part.
public static async Task<TEntity> GetFirstOrDefaultAsync<TEntity,TDbContext>(this TDbContext dbContext, Expression<Func<TEntity, bool>>? predicate = null,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>>? orderBy = null,
Func<IQueryable<TEntity>, IIncludableQueryable<TEntity, object>>? include = null,
bool disableTracking = true,
CancellationToken cancellationToken = default(CancellationToken))
where TEntity : class
where TDbContext : CacheawareDbContext
{
IQueryable<TEntity> query = dbContext.Set<TEntity>();
if (disableTracking)
{
query = query.AsNoTracking();
}
if (include != null)
{
query = include(query);
}
if (predicate != null)
{
query = query.Where(predicate);
}
if (orderBy != null)
{
return await orderBy(query)
.Cacheable(cacheExpirationMode,timeSpan.Value)
.FirstOrDefaultAsync(cancellationToken);
}
else
{
return await query
.Cacheable(cacheExpirationMode,timeSpan.Value)
.FirstOrDefaultAsync(cancellationToken);
}
}
from efsecondlevelcache.core.
Thank you for your help. I do very much appreciate it. I'm closing this now, since I couldn't track the core issue, which is obviously on my par.
from efsecondlevelcache.core.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related problems.
from efsecondlevelcache.core.
Related Issues (20)
- using EF Core 3.0: bugs in async cached query HOT 2
- Breaking changes regarding efcore 3.0.0 type: ExpressionPrinter HOT 2
- How to handle offline Redis cache? HOT 2
- Upgrade to .NET Core 3.0 preview 9 HOT 2
- FileNotFound HOT 2
- Cached value sometimes invalid HOT 4
- Support order by? HOT 4
- .Cacheable() method is locking thread in async environment? HOT 10
- How to separate IQueryable With Key ? HOT 3
- خطای AD0001 HOT 2
- EFCachedDbSet & OrderBy HOT 4
- What's redisConfigurationKey = "redis" HOT 2
- Now Microsoft.EntityFrameworkCore (>= 3.1.0) can be used even for .NET Standard 2.0 HOT 3
- Tests are failing HOT 1
- Just want to discuss improvement which i might be able to contribute HOT 3
- Sliding expiration not work correctly HOT 1
- Unable to include navigation properties when using EFCachedDbSet HOT 2
- Redis cache issue with Entity framework model classes - dotnet core 3.1 HOT 3
- Announcing a better Second Level Caching Library!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from efsecondlevelcache.core.