-
Notifications
You must be signed in to change notification settings - Fork 40
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
[D8][PS] Integrate the functionality of the entity_cache module into core #74
Comments
Comparable D8 issue, for reference: https://drupal.org/node/597236 |
+1 for entity cache |
Why shouldn't this be a module? |
This makes sense being part of core (and always enabled) because entity caching is a level of cache that is reliable and easily cleared and updated automatically when corresponding entities are updated. As long as the appropriate APIs are used (e.g entity_save(), node_save()), adding entity-level caching means that we can save database queries not only for fields, but also for entries in other tables, such as the webform* tables for Webform, path redirects, metadata, or anything else that's not a field. Adding the entity-level cache also means we could remove the field-level cache, since at that point they'd be redundant. |
I agree that it should be in core and enabled by default, just not that it should be something other than it's own module. It can be hidden if you want, but it should still be replaceable by developers. I don't agree that it is redundant with field level cache. I'm pretty sure the reasons are covered adequately in the D8 issue discussion. |
I couldn't find explanations in the D8 issue for why the field cache and entity cache are both necessary. I can't figure a reason why both are independently needed, other than if you could disable the entity cache then you'd want the separate field cache. However, entire-object caching makes sense to always have enabled because there's no downside for end-users. There's no risk of stale data because we know when the node/user/term is being updated (via entity_save()) and can clear the cache. It's similar to the filter caches that can't ever be disabled. If there's no risk of stale data, the cache should always enabled. |
D8 has also changed to storing all field data with the entity bundle itself, rather than as independent objects, so it makes sense to cache the full objects. There's a discussion in https://drupal.org/node/597236 that may be helpful. |
Converted just enough to eliminate WSODs and get the tests to run. I'm waiting to see if the test pass, but wanted to share early. |
This is a good feature for Backdrop for certain. If it's possible to add to a 1.x minor release let's still try to have this as a replacement for field cache, but if not, I'd love to see this in the 2.0 release. |
I think I have everything done for this except for one test case that is failing. I have spent a while trying to debug it, and I have no idea why it is failing. |
@hosef I'm curious; the test fail is |
@docwilmot The node does exist, but it looks like there isn't a field on the node. When I put a debug message in there to print out the node, then it will be missing the field property entirely. |
But is it the node you expect (should be NID == 3) or is it one of the default nodes from the install profile? |
The nid is 1. The tests don't use the default profile, so there is no content unless you make it as part of the test. I modified the test to add a couple of debug statements, so now it is as follows:
The output from the first debug is:
And the second is:
So, we know that there is a node and there is data in the field table, but for some reason the field data is not being attached to the node when loading it. |
Had a look at the PR. The fail happens because of the call to Thats the reason for the fail, but cant tell you the fix; hopefully this is helpful. |
See the PR itself for the review. |
Ah, sorry @docwilmot I was reading this issue which is still labeled |
I updated the PR based on @docwilmot's review. Thanks for that! I also found new calls to As this could have far-reaching consequences I don't think we should rush it into 1.15, but I'm marking this RTBC for 1.16! We can merge it shortly after branching 1.15.x (which will happen Jan 15). |
I updated the documentation for |
Are we deprecating |
Yes, I think we should. There is an issue at #2158. |
It's now been a few weeks since 1.15.0 came out and we've branched for 1.15.x. I've merged backdrop/backdrop#2927 into 1.x for 1.16.0! Thanks so much @hosef for taking the lead on this and really following through! Super awesome! Thanks @matt2000 for the earliest work. Thanks @docwilmot and @oadaeh for your feedback and reviewing! |
I'm reopening this until we have a change-record to document how it works and what it changes. In particular describing the way that things like the "new" attribute on comments now has to be set after the cache is loaded, rather than being set in the database loading function. |
I was going to take a stab at creating a change record for this, but I'm afraid I don't really know how to summarize what changed. I was going to copy what went into D8's change record, but apparently they don't have one either. |
@hosef told me he was going to create a change record for this, since he believed it was not a big deal. I'll just continuously nag him until he gets it done. :) |
@hosef added a draft change record here: https://api.backdropcms.org/change-records/entity-caching-added-to-core |
Looks good! I edited it slightly and added a section on the It's now published. Thanks @hosef! |
So, this issue can be closed now? |
...but not as a module... just as part of Backdrop, maybe part of the entity system?
Advocate for this issue @hosef
Weekly update?
PR by @hosef: backdrop/backdrop#2927
Change record: https://api.backdropcms.org/change-records/entity-caching-added-to-core
The text was updated successfully, but these errors were encountered: