Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6912461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:05:43+00:00 2026-05-27T09:05:43+00:00

I am attempting to use Zend_Cache_Frontend_Function to cache some of my own function calls.

  • 0

I am attempting to use Zend_Cache_Frontend_Function to cache some of my own function calls.

The cache is set up like so:

$manager = new Zend_Cache_Manager();

$frontendOptions = array(
   'lifetime' => intval(CACHELIFETIME),
   'automatic_serialization' => true);

$backendOptions = array('cache_dir' => CACHEDIR);

$funcCache = Zend_Cache::factory('Function',
'File',
$frontendOptions,
$backendOptions);

$manager->setCache('function', $funcCache);

I then use the cache like so:

$country_name = "UK";
$country_id = 1;

$country = new Default_Db_Table_Country();
$country = $cache->call(array($country, "getCountryByName"), array($country_name, $id));

Even after calling this several times, the function getCountryByName() is still being called and the database query within it run.

Am I using this correctly? How can I stop the call to getCountryByName() happening multiple times?

Thanks

Edit:

Looking at the source, it seems that call() uses output buffering, if this is the case then my functions output nothing, they only return objects. Thus making Zend_Cache_Frontend_Function useless in this case?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:05:44+00:00Added an answer on May 27, 2026 at 9:05 am

    It would seem that Zend_Cache_Frontend_Class is the way to go and not Function. I need to set the class before each call to ensure the right object is being used;

    $country = new Default_Db_Table_Country();
    $cache->setCachedEntity($country);
    $country = $cache->getCountryByName($country_name, $id);
    

    This Frontend does cache objects, arrays, etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to use JUnit to test some database code. I'm pretty new to
I'm attempting to use the new Storyboard feature, however I am confused about Storyboard
I am attempting to use Castle Windsor in my automated tests like so: On
I am attempting to use the function DBMS_AQ.DEQUEUE_ARRAY in Oracle 10.2.0.4.0. to browse the
I'm attempting to use the rest-client gem to post something, but for some reason,
I'm attempting to use the new partial page caching available in ASP.NET MVC 3.
I am attempting to use OpenSSL's SHA512 function in a C++ project of mine.
While attempting to use the CopyFile() function I have encountered a strange error. It
I'm attempting to use selenium to automate some browser-based data entry. The target URL
I'm attempting to use a sample function on the PHP manual website (posted by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.