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 7763127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:35:12+00:00 2026-06-01T14:35:12+00:00

I’m looking for solution for a in memory script cache, using Zend_Cache and zend

  • 0

I’m looking for solution for a in memory script cache, using Zend_Cache and zend framework.

We have a few cases in our application, that in order to display a table with, let’s say, 100 elements, the logic is as the following:

  • fetch 100 items from the content table (a single query)
  • for every item, get the creator user and user who approved the content from the db / memcache backend (this is usually done from a for loop)

In most cases, the user who approved the content is a 2 or 3 admin users, however the script calls the database / memecache multiple times. It gets worse, as the user model has to query 3 different tables to know which role the user belong to, and which community he also belongs to.

So all in all, to display a table of 100 items, we query the database (or memcache server) 600 times 🙂

I was thinking about 2 solutions here:

  • Not to query the users table inside the loop. Loop over the 100 items, get all the user IDs and get all the users in a single query. I’m not that sure it would be a good solution, as it mean I’ll have to write sql joins causing the model functions to return a non Zend_Db_Table_Row, which we use heavily.

  • another solution is to save the user object into a in memory cache array on first load, and next time the loop tries to read the user id, it will first look up in this “special” in memory cache. I was thinking about using Zend_Registry as the cache backend, similar to the solution here: http://sameerparwani.com/posts/using-zend_registry-as-a-zend_cache-backend

We do use memcache server, but the script just queries the memcache server few hundred times instead of query the mysql database. It is faster to query the memcache server, however, as the script already loads this data, i want to use the script “memory” and not query an external server.

  • 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-06-01T14:35:14+00:00Added an answer on June 1, 2026 at 2:35 pm

    Take a look at FaZend, there is an implementation of it. On taking a look into the code it should work a little bit different (e.g no TTL, test() returns a boolean) but it could be enough for you. Not tested !

    Edit:

    Since Zend Framework 2 there is an implementation for it: Zend\Cache\Storage\Adapter\Memory

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
We're building an app, our first using Rails 3, and we're having to build
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have thousands of HTML files to process using Groovy/Java and I need to
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
this is what i have right now Drawing an RSS feed into the php,
I am reading a book about Javascript and jQuery and using one of the

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.