I have a site where this module is used on every node creation and users create a few nodes every day. The table cache_entityconnect is growing fast and is becoming really big because their entries are never cleaned.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

camilo.mejia created an issue. See original summary.

camilo.mejia’s picture

- Changed parameter CACHE_PERMANENT to REQUEST_TIME + 21600 on cache_set
- Added hook_flush_caches

steinmb’s picture

Title: Clear cache » Ability to flush cache_entityconnect. Never clearing it might not scale
Category: Bug report » Feature request
Status: Active » Needs review

I' currently reviewing this module. What about having the time configurable? Define the time in variable and if it is not set, never expire? You did not say anything about the size of the site you see this on and the size of the cache table. Care to touch on that?

  • jygastaud committed 076fec5 on 7.x-1.x authored by camilo.mejia
    Issue #2608188 by camilo.mejia: Ability to flush cache_entityconnect....
  • jygastaud committed 0e36b3c on 7.x-1.x
    Issue #2608188 by camilo.mejia: Add cache lifetime administration.
    
jygastaud’s picture

Status: Needs review » Fixed

Thanks @camilo.mejia for the patch.
hook_flush_caches is a nice catch. I forgot it.

I also agree with @steinmb. It would be perfect to add an option into the administration to be able to fix the cache lifetime and default to CACHE_PERMANENT if nothing is set.

So, I just push that option inside 7.x-1.x branch.

I mark that issue as fixed.
If something wrong happen, please reopen it.

Thanks.

  • jygastaud committed d313e71 on 7.x-2.x
    Issue #2608188 by camilo.mejia: Add cache lifetime administration.
    
  • jygastaud committed ee68a80 on 7.x-2.x authored by camilo.mejia
    Issue #2608188 by camilo.mejia: Ability to flush cache_entityconnect....
steinmb’s picture

@jygastaud thank you :)

camilo.mejia’s picture

I choose 21600 because is the same time Drupal core use to cache their forms: https://api.drupal.org/api/drupal/includes%21form.inc/function/form_set_.... I think a configurable parameter is not necessary because this cache could exist at least the same time that the cached core forms.

For Drupal 8, instead of a configurable parameter, you could use variable_get('cache_form_expiry', 21600); or whatever the core team decide to use when they finish this: https://www.drupal.org/node/2091511

aharris6’s picture

Thank you for this patch, @camilo.mejia and @jygastaud...worked perfectly and solved my giant database issue

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.