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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:26:18+00:00 2026-05-13T05:26:18+00:00

I think I’m getting crazy, I’m trying to implement Zend_Cache to cache my database

  • 0

I think I’m getting crazy, I’m trying to implement Zend_Cache to cache my database query. I know how it works and how to configure.

But I can’t find a good way to set the Identifier for the cache entries. I have a method which searches for records in my database (based on an array with search values).

/**
 * Find Record(s)
 * Returns one record, or array with objects
 *
 * @param array   $search Search columns => value
 * @param integer $limit  Limit results
 * @return array One record , or array with objects
 */
public function find(array $search, $limit = null)
{
    $identifier = 'NoIdea';

    if (!($data = $this->_cache->load($identifier))) {
        // fetch
        // save to cache with $identifier..
    }

But what kind of identifier can use in this situation?

  • 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-13T05:26:19+00:00Added an answer on May 13, 2026 at 5:26 am

    The identifier should be a unique string to represent the cache entry.

    You might like to name them based on your database tables and fields, e.g. db_tablename_primarykey_1

    If you have a method with several arguments, it’ll be a pain to make a string containing all of them. Alternatively you can concat a function’s arguments and the db_tablename to produce a string for hashing. For example:

    $identifier = md5('db_tablename_find' . serialize(func_get_args()));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think I'm on to a good idea, but don't know how to implement
I think I've seen this answer, but I can't remember where for certain. I'm
Think my problem is I am trying to sum a count in the same
I think I have a basic understanding of this, but am hoping that someone
I think this could be a very easy question for you. But I have
Think Windows Explorer's 'Details' view. I need to output my database to this view.
I think that asking this might be kind of silly but I'm still wondering
I think I have found a bug when setting or getting the Me.Top property
I think it will be very hard for you to read the code but
Think 2 entities OneToOne mapped. Person and Car. A Person can have a Car.

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.