<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -14,17 +14,18 @@ module Database
   end
   
   def self.db
-    db = YAML.load(File.read(&quot;#{ROOT}/db/database.yml&quot;))
+    @db ||= begin
+      YAML.load(File.read(&quot;#{ROOT}/db/database.yml&quot;))
     
-    # We need to add collections to the products    
-    db['products'].each do |product|
-      collections = db['collections'].find_all do |collection|
-        collection['products'].any? { |p| p['id'].to_i == product['id'].to_i }
-      end      
-      product['collections'] = collections      
+      # We need to add collections to the products    
+      db['products'].each do |product|
+        collections = db['collections'].find_all do |collection|
+          collection['products'].any? { |p| p['id'].to_i == product['id'].to_i }
+        end      
+        product['collections'] = collections      
+      end        
+      db
     end
-        
-    db
   end
   
 end
\ No newline at end of file</diff>
      <filename>server/lib/database.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e484a142c33610752b416750d96e10babe590d41</id>
    </parent>
  </parents>
  <author>
    <name>tobi</name>
    <email>tobi@leetsoft.com</email>
  </author>
  <url>http://github.com/Shopify/vision/commit/505ecf2b26424d0732067886bbaf5925f1f08a5e</url>
  <id>505ecf2b26424d0732067886bbaf5925f1f08a5e</id>
  <committed-date>2009-06-14T12:31:32-07:00</committed-date>
  <authored-date>2009-06-14T12:31:32-07:00</authored-date>
  <message>Don't re-read the DB every single call.</message>
  <tree>6a5c20ea064917fe6c0b97e46944e6530f375887</tree>
  <committer>
    <name>tobi</name>
    <email>tobi@leetsoft.com</email>
  </committer>
</commit>
