SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Cache resultset

  1. #1
    SitePoint Zealot sanka69's Avatar
    Join Date
    Apr 2003
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cache resultset

    Hi all;
    Literally only started looking at Rails two days ago so please forgive me is this is flamebait material!

    Need to perform a search (using TSearch2 in postgres). The database I'm searching is particularly complex and hugge so searching isn't fastest. In a PHP based front end I would have cached the primary keys of the records found in the initial search. The interface is paginated, only showing 1 record a page with the typical forward and back buttons.

    Presumably caching the result from the find() function is still a good approach in rails, but I can't quite work out how.. any suggestions would be a great help!

    Cheers
    Richard

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    California
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How did you paginate the keys in PHP? If you post your PHP code here, I'd be happy to translate that section to Ruby.
    Happy switcher to OS X running on a MacBook Pro.

    Zend Certified Engineer

  3. #3
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rails can cache a model with a plugin (in memory):

    http://rubyforge.org/frs/?group_id=1266

    But I haven't used it so I don't know how configurable that is. (maybe it can cache only the entire model, but you can still use the basic caching method I presume).

  4. #4
    SitePoint Zealot sanka69's Avatar
    Join Date
    Apr 2003
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry for the delay.. I'll check the cache mechanism out.

    xmitchx: thanks for the offer. the code simply has an array of all the PK's, and I store in a session variable the array and the index of where I'm currently looking.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •