-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Add Cacheable Entity #14337
Add Cacheable Entity #14337
Conversation
@sebastienros I am moving the discussion here. In your comment you stated the following
You may be able to suggest better one. Ideas? The problem adding a new property on But if you think
|
Okay, will look at it when I will have time. |
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/CacheableEntity.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/ICacheableEntity.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/ICacheableEntityExtensions.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/ICacheableEntityExtensions.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/ICacheableEntityExtensions.cs
Outdated
Show resolved
Hide resolved
|
||
namespace OrchardCore.Settings | ||
{ | ||
// When updating class also update SiteSettingsDeploymentSource and SettingsStep. | ||
public class SiteSettings : DocumentEntity, ISite | ||
public class SiteSettings : DocumentEntity, ICacheableEntity, ISite |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to let DocumentEntity
implements ICacheableEntity
instead, so all the implementation will be no long exist here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure we want that behavior applied everywhere. If that is the cache, we can just remove ICacheableEntity
and move the new methods into IEntity
instead. Look at the notes in the description of the PR.
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/CacheableEntity.cs
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/CacheableEntity.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/CacheableEntity.cs
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/CacheableEntity.cs
Show resolved
Hide resolved
@MikeAlhayek, please check my changes |
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/CacheableEntity.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/CacheableEntity.cs
Outdated
Show resolved
Hide resolved
src/OrchardCore/OrchardCore.Infrastructure.Abstractions/Entities/CacheableEntity.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hishamco not a fan of the changes.
Check my comment, otherwise I will revert my changes :) |
@hishamco I left you comments on the changes you made please visit them so we can finalize the PR. |
I might let @jtkech review this PR too if he has a time |
The interface ICacheableEntity provides a way to cache properties in IEntity. This will improve the speed of retrieving the settings from SiteService.
@sebastienros brought up this issue during the call today.
@jtkech thoughts on this approach?
In this current approach, a new
ICacheableEntity
interface was added. The idea is to makeIEntity
cacheable when needed. If you need (you should in most cases)IEntity
, then implementICacheableEntity
instead ofIEntity
or inherit fromCacheableEntity
instead ofEntity
.If we want to make
IEntity
cacheable all the time, we can simply drop the newICacheableEntity
interface, and move it's methods toIEntity
instead. I just don't know if using cache for everything by default is a good idea. Maybe it is, I am just not very convinced. if @sebastienros and @jtkech think it's appropriate, I can simplify by removingICacheableEntity
.