Feature Request #2848

list_columns() caching

Added by Kemal Delalic about 4 years ago. Updated over 3 years ago.

Status:ClosedStart date:05/04/2010
Priority:NormalDue date:
Assignee:Isaiah DeRose-Wilson% Done:

0%

Category:-
Target version:Kohana v3.x - v3.0.9
Resolution:wontfix Points:

Description

It would be nice to add list_columns() caching to ORM, at least if application-level caching is enabled.

At the moment I have this method rewritten this way;

public function list_columns()
    {
        if( Kohana::$caching )
        {
            $existing_cache = Kohana::cache( 'columns_' . $this->_table_name );

            if( $existing_cache )    return $existing_cache;

            $columns = $this->_db->list_columns($this->_table_name);

            Kohana::cache( 'columns_' . $this->_table_name , $columns, 6000 );

            return $columns;
        }

        return $this->_db->list_columns($this->_table_name);
    }

pokIt_.jpg (26.5 KB) Kemal Delalic, 05/04/2010 01:02 PM


Related issues

Duplicated by ORM - Feature Request #3320: Caching of column information in ORM Closed 10/11/2010

History

#1 Updated by Kemal Delalic about 4 years ago

Ok, I managed to screw the code up, but you get the point

#2 Updated by Kemal Delalic about 4 years ago

#3 Updated by Sam Wilson about 4 years ago

+1

I would love to see this implemented in Database.

(This should be moved to the Modules:Database category, I think.)

#4 Updated by Woody Gilk about 4 years ago

  • Target version set to v3.0.6

#5 Updated by Woody Gilk about 4 years ago

  • Status changed from New to Assigned
  • Assignee set to John Heathco

#6 Updated by Woody Gilk about 4 years ago

  • Target version changed from v3.0.6 to v3.0.7

#7 Updated by John Heathco about 4 years ago

  • Status changed from Assigned to Feedback
  • Assignee changed from John Heathco to Woody Gilk

Woody, what do you think about moving this to the database layer versus ORM?

#8 Updated by Woody Gilk about 4 years ago

That probably makes sense, but not without a way to delete query caches, which isn't currently possible. There's a related issue somewhere around here.

#9 Updated by Woody Gilk about 4 years ago

  • Target version changed from v3.0.7 to v3.0.8

#10 Updated by Woody Gilk almost 4 years ago

  • Target version changed from v3.0.8 to v3.0.9

#11 Updated by Isaiah DeRose-Wilson almost 4 years ago

  • Project changed from Kohana v3.x to ORM
  • Category deleted (Modules:ORM)

#12 Updated by Isaiah DeRose-Wilson over 3 years ago

  • Status changed from Feedback to Closed
  • Assignee changed from Woody Gilk to Isaiah DeRose-Wilson
  • Resolution set to wontfix

I don't really see the need for this. The only real advantage would be to avoid opening a database connection, but if you are loading a database model you already need a database connection. In my experience list_columns() is just as fast as reading a cache file. If you are really worried about performance you can manually define the fields in your model to avoid the call at all. See the related issue for information about benchmarking.

Also available in: Atom PDF