CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • 5.0 Saloon »
  • Caching (page/api/sql level?)
Pages: [1]

Author Topic: Caching (page/api/sql level?)  (Read 815 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Caching (page/api/sql level?)
May 29, 2014, 12:21:10 am
Hi,

We got currently quite a few cache here and there (the pseudo constants, acl...), but there a common framework that could be used.

For instance, we have been using civi as a backend for several contacts and now we are displaying the results:
http://ep2014.org/map/mep/3

Most of the data (list of parties, elected persons...) isn't going to move anymore, or at least not often and for performance reason, I wanted to either cache the result page or the api calls.

Is this something that would be easier to do with doctrine?
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

totten

  • Administrator
  • Ask me questions
  • *****
  • Posts: 695
  • Karma: 64
Re: Caching (page/api/sql level?)
May 29, 2014, 01:51:10 pm
a) Unless there's a problem or reason to do otherwise, a page-level cache will probably provide the best performance for a screen whose content doesn't really change. It looks like you're probably using the CMS as the page-controller, so you'd want to follow the CMS's guidelines for making the page-content cachable.

b) Doctrine does have a "result" cache feature. This might make sense if some parts of the page are dynamic but some data is cacheable:

http://docs.doctrine-project.org/en/2.0.x/reference/caching.html#result-cache

c) If you did need dynamic pages with cached query-results, then I don't think it would be very hard to write a similar TTL cache for the API using an API wrapper (4.4) or subscriber (4.5+), e.g.

Code: [Select]
$result = civicrm_api3('Contact', 'get', array(
  ...
  'options' => array(
    'cache' => array('mycachebucket', 3600),
  ),
));

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • 5.0 Saloon »
  • Caching (page/api/sql level?)

This forum was archived on 2017-11-26.