I think it would be a big improvement for that module, if it would be able to ajaxify not only blocks but fields. To give an use case example:
I have a site with many views blocks on each page. All this blocks are the same for each user, with the exception of some fields: a rate widget, and some flags etc.
So, if I want to make the page cacheable, I have to load all that blocks via Ajax (or ESI), but wouldn't it be better to load only those fields that way.
I found a module that is capable to load fields via Ajax: https://drupal.org/project/peekaboo
Maybe it would be possible to use it's code basis to integrate this function in authcache?
Would do you think about that?

CommentFileSizeAuthor
#1 authcache-field-edit.png60.89 KBznerol
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

znerol’s picture

FileSize
60.89 KB

Just committed a proof of concept for this functionality (5b9db0f. Although I'm not sure whether this implementation is that useful. The workflow is like this:

  1. Enable authcache_field module
  2. Navigate to Admin » Structure » Content Types » (some contet type) » manage fields
  3. In the field settings find the "Authcache" checkbox and enable it (see attached screenshot)
  4. Adapt the settings revealed when the checkbox is enabled

Authcache will then load the field values of that field using one Ajax request for every entity displayed on the page.

If you have the chance to test this against your use case, then please provide me some feedback.

Firstly I'm not really sure whether authcache settings should stay in the field settings or whether it would be useful when it would be possible to define them per view-mode (separate for teaser, full view, etc.).

Secondly I'm wondering whether it would be useful when multiple fields could be loaded in one request.

znerol’s picture

Status: Active » Postponed (maintainer needs more info)
gurrmag’s picture

Hi, again!

I have a very similar use case in that I have a ratings field that is displayed on products and on product lists.

Although, as it stands, this works well for me, I can see situations where you would need to handle fields differently, for example in full content view-mode on the one hand where something like cache expire would take care of updating, and a view-mode that is used in a view where it would be a sledgehammer/nut scenario to clear the entire view cache for an update on one node. It would be a bit more config to set up in each view mode, but I think this would be worth it.

If it is used on a field in a view-mode that is output via a view, then, if possible, multiple fields should probably be loaded in a single request to keep pages as fast as possible. This is the main situation I see where you would want to run multiple ajax requests for a field at once, so could authcache_views be enhanced to work with ajax settings on fields, both when rendering view-modes, and when displaying fields themselves?

Cheers

szymon.l’s picture

Hi,

I have a problem with authcache + memcache, that is somehow relevant to this issue..

I am running a drupal commerce site, with products (obviously).

A "product" is an entity, and it is referenced by a "product display", which is a node.

A "product", has fields - where two of them are most important - price and stock level.

I have enabled authcache field and enabled it on the stock level field (it was impossible to add to price field since it is blocked from editing and even though I could configure it there was no save button!) and... it just doesn't work. The field is still in cache.

Can it have something to do with the fact that "product" is not a node?

szymon.l’s picture

PS. maybe the source of the problem is in authcache_builtin_expire_v2 ?

I have setup a cache expiration module with external expiration (authcache_builtin_expire_v2)

But even though the content has expired (I can see log message in dblog) the page is not removed from cache..

znerol’s picture

@szymon.l: The Expire-approach is the right one in your use case. I am still not convinced that personalized fields are useful at all.

If you find that expire is not working properly, then please open a new bug report. Like this it is easier for me to keep track of it and its also easier for others to find it. Thanks.

znerol’s picture

@szymon.l: I just found a problem with expire v2 integration. Please test the patch contained in #2177265: Authcache Builtin Cache Expiration v2 does not work on pages with alias and comment there whether it solves your issue.

szymon.l’s picture

@znerol: thank you, I will test the patch in few days (I hope), I had to migrate to new server, and for now, I had to disable any caching modules. I should have a "sandbox" version of my site this weekend so I will do the test.

znerol’s picture

Issue summary: View changes
znerol’s picture

znerol’s picture

deardagny’s picture

I've been looking for this functionality for Commerce products as well. I've selected the Authcache option on a flag field that is used in a "wishlist" capacity. The field is printed directly in a tpl for formatting reasons. It seems like no matter how I configure the field, the page is excluded and I receive the "Message 1: "Canceled: FIXME: authcache_field - what should we do with custom view_modes?" message in debug.

Not sure if this is just due to the POC status or if I'm misunderstanding the intended usage of authcache_field.

znerol’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)