<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -79,6 +79,15 @@ With a limit attribute, indices will only store limit + buffer in the cache. As
 
 `Message.count(:all, :conditions =&gt; {:sender_id =&gt; ...})` will use the cache rather than the database. This happens for &quot;free&quot; -- no additional declarations are necessary.
 
+### Version Numbers ###
+
+    class User
+      version 7
+      index ...
+    end
+    
+You can increment the version number as you migrate your schema.
+
 ### Transactions ###
 
 Because of the parallel requests writing to the same indices, race conditions are possible. We have created a pessimistic &quot;transactional&quot; memcache client to handle the locking issues.
@@ -136,7 +145,6 @@ Sometimes your code will request the same cache key twice in one request. You ca
 #### Step 1: `config/initializers/cache_money.rb` ####
 
 Place this in `config/initializers/cache_money.rb`
-
     require 'cache_money'
     
     config = YAML.load(IO.read(File.join(RAILS_ROOT, &quot;config&quot;, &quot;memcache.yml&quot;)))[RAILS_ENV]</diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -66,7 +66,7 @@ module Cash
       end
 
       def cache_key(key)
-        &quot;#{name}/#{key.to_s.gsub(' ', '+')}&quot;
+        &quot;#{name}:#{cache_config.version}/#{key.to_s.gsub(' ', '+')}&quot;
       end
     end
 </diff>
      <filename>lib/cash/accessor.rb</filename>
    </modified>
    <modified>
      <diff>@@ -10,6 +10,7 @@ module Cash
     module ClassMethods
       def self.extended(a_class)
         class &lt;&lt; a_class
+          attr_reader :cache_config
           delegate :repository, :indices, :to =&gt; :@cache_config
           alias_method_chain :inherited, :cache_config
         end
@@ -25,6 +26,10 @@ module Cash
         (@cache_config.indices.unshift(Index.new(@cache_config, self, attributes, options))).uniq!
       end
 
+      def version(number)
+        @cache_config.options[:version] = number
+      end
+
       def cache_config=(config)
         @cache_config = config
       end
@@ -50,6 +55,10 @@ module Cash
         @options[:ttl]
       end
 
+      def version
+        @options[:version] || 1
+      end
+
       def indices
         @indices ||= active_record == ActiveRecord::Base ? [] : [Index.new(self, active_record, active_record.primary_key)]
       end</diff>
      <filename>lib/cash/config.rb</filename>
    </modified>
    <modified>
      <diff>@@ -22,8 +22,8 @@ module Cash
         describe 'when there is a total cache miss' do
           it 'yields the keys to the block' do
             Story.fetch([&quot;yabba&quot;, &quot;dabba&quot;]) { |*missing_ids| [&quot;doo&quot;, &quot;doo&quot;] }.should == {
-              &quot;Story/yabba&quot; =&gt; &quot;doo&quot;,
-              &quot;Story/dabba&quot; =&gt; &quot;doo&quot;
+              &quot;Story:1/yabba&quot; =&gt; &quot;doo&quot;,
+              &quot;Story:1/dabba&quot; =&gt; &quot;doo&quot;
             }
           end
         end
@@ -32,8 +32,8 @@ module Cash
           it 'yields just the missing ids to the block' do
             Story.set(&quot;yabba&quot;, &quot;dabba&quot;)
             Story.fetch([&quot;yabba&quot;, &quot;dabba&quot;]) { |*missing_ids| &quot;doo&quot; }.should == {
-              &quot;Story/yabba&quot; =&gt; &quot;dabba&quot;,
-              &quot;Story/dabba&quot; =&gt; &quot;doo&quot;
+              &quot;Story:1/yabba&quot; =&gt; &quot;dabba&quot;,
+              &quot;Story:1/dabba&quot; =&gt; &quot;doo&quot;
             }
           end
         end
@@ -145,5 +145,15 @@ module Cash
         end
       end
     end
+
+    describe '#cache_key' do
+      it 'uses the version number' do
+        Story.version 1
+        Story.cache_key(&quot;foo&quot;).should == &quot;Story:1/foo&quot;
+
+        Story.version 2
+        Story.cache_key(&quot;foo&quot;).should == &quot;Story:2/foo&quot;
+      end
+    end
   end
 end</diff>
      <filename>spec/cash/accessor_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>1024a91c27c795df01837e2de24c70b37fc3349e</id>
    </parent>
  </parents>
  <author>
    <name>Nick Kallen</name>
    <email>nkallen@nick-kallens-computer-2.local</email>
  </author>
  <url>http://github.com/brynary/cache-money/commit/6af729a08644a6e0aa361d901d223865249b1f3f</url>
  <id>6af729a08644a6e0aa361d901d223865249b1f3f</id>
  <committed-date>2008-12-11T21:52:14-08:00</committed-date>
  <authored-date>2008-12-11T21:52:14-08:00</authored-date>
  <message>version numbers</message>
  <tree>44f34a4de4478fb2f9440c25056ea6f89a147650</tree>
  <committer>
    <name>Nick Kallen</name>
    <email>nkallen@nick-kallens-computer-2.local</email>
  </committer>
</commit>
