Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #3174 (closed enhancement: fixed)

Opened 5 years ago

Last modified 4 years ago

[PATCH] add connection_cache_key method to AR

Reported by: skaes Assigned to: David
Priority: normal Milestone: 1.2
Component: ActiveRecord Version: 0.14.3
Severity: normal Keywords: performance connection_cache
Cc:

Description

This patch adds a connection_cache_key method to AR which replaces klass.name, and can be used to reduce the number of active? calls down to the number of database connection specs used by a running rails instance. Currently, active? is called n times during each request, where n is the number of AR classes involved. For a request touching 3 classes, I have seen a 3% improvement, when defining the cache_key as a constant. I suspect for requests involving lots of AR classes, the savings could be substantial.

Attachments

connection_cache_key.patch (3.8 kB) - added by skaes on 12/10/05 07:51:58.
connection_cache_key.2.patch (3.6 kB) - added by skaes on 12/10/05 08:00:40.

Change History

12/10/05 07:51:25 changed by skaes

  • keywords set to performance connection_cache.

12/10/05 07:51:58 changed by skaes

  • attachment connection_cache_key.patch added.

12/10/05 08:00:40 changed by skaes

  • attachment connection_cache_key.2.patch added.

12/10/05 08:01:58 changed by skaes

use the second patch. The first version was generated incorrectly.

02/18/06 23:50:01 changed by david

  • summary changed from [PPATCH] add connection_cache_key method to AR to [PATCH] add connection_cache_key method to AR.

10/08/06 18:13:42 changed by skaes

  • status changed from new to closed.
  • resolution set to fixed.