I have a view that is time-based cached.

One of the options on the exposed form is a 'near me now', which sorts the results by distance and displays mileage.

The users location is provided by the IPM&V Module, and works fine with the view cache turned off.

The problem is that with cache-view turned on, sorting by near me now continues to display the results based on previous requests. The view is 'cached' and not using the current users location.

I could simply turn views caching off, but hate losing the extra speed.

Is there a way (a hook or function) that tells views to 'refresh/clear cache' if certain conditions are met? Ie, if user selects 'near me now' do not cache.

I looked at a combination of rules/cache action, but couldn't get it to work on a specific filter input.

Any ideas appreciated.

  • How about this... drupal.org/node/322104 ... An alternative solution would be to empty the page cache for that particular page once a day/hour to make sure that it's relatively up to date... Jun 29, 2014 at 18:29
  • Thanks for the reply, but that really doesn't work. Since User A comes and says show me nearby items, and then a few seconds later User B comes and shows me nearby items. So empty the cache once a day, etc isn't a solution -- since each user has their own view results. Jun 29, 2014 at 19:55

1 Answer 1


How about this module: https://www.drupal.org/files/images/Views_content_cache.png

Without testing it I cannot tell if it will expose the 'nearby' state as a filter for for the update cache function but looks like a good place to start: enter image description here

  • Awesome module, will come in handy for other cases. But only seems to be on editing/adding/deleting content. So can't use in this instance. Jun 29, 2014 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.