in a view, one field has the following computed value, which takes a lot of time to return results from the database: 

<?php $term = taxonomy_term_load($data->tid); print count_term_get_node_count($term); ?>

parent term 1: 23
parent term 2: 45

when one clicks on the parent term 1 link, she is seeing the count of nodes of the children taxonomy terms of parent term 1:

1st child of parent term 1: 33 2nd child of parent term 1: 89 and so on.

How could i cache the results of the whole view, i would like to run the count_term_get_node_count with a cron job, every night, and calculate the results for each term that exists in the vocabulary?

I tried with the views custom cache module, but i am not getting the results i need, something is not working well.

1 Answer 1


I solved a similar problem a little differently. You can create a computed field in the taxonomy and recalculate it either with a cron job for all terms, or after adding/editing a node for specific terms of this node. In the settings of the calculated field, select "stored in the database". And in the View display the value of this field, stored in database.

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.