Open diabolus opened 13 years ago
Can you write a test case for this?
I'm on it now.I sent you a detailed mail for this testing issue. Thanks. i gonna send test files ASAP.
Cool.
There is a version problem on these branch.Test files are for Rails 2.I made some changes like RSpec.configure and do the tests. Some of tests are failing.
vendor/plugins/cache-money/spec/cash$ rspec finders_spec.rb
Finished in 1.09 seconds 42 examples, 34 failures
I recently installed this branch and when i created a new dummy record like Book cache key setted like "Book:1/3" when i updated it a new cache key setted like "Book:1/id/3" and they doesnt match on show and update screens.plugin always call first created cache key "Book:1/3" and always same values comes up.
here is the record creation debug logs:
Started GET "/books/3" for 127.0.0.1 at 2011-02-24 12:34:00 +0200 Processing by BooksController#show as HTML Parameters: {"id"=>"3"} CACHE GET "Book:1/3" Memcached get: "Book:1/3" Memcached miss: "Book:1/3" Book Load (0.3ms) SELECT
books
.* FROMbooks
WHEREbooks
.id
= 3 LIMIT 1 CACHE ADD Book:1/3 = #<Book id: 3, title: "new book", author: "new book", created_at: "2011-02-24 10:34:00", updated_at: "2011-02-24 10:34:00"> (604800, ) Memcached add: "Book:1/3" Memcached hit: "Book:1/3" Rendered books/show.html.erb within layouts/application (2.7ms) Completed 200 OK in 47ms (Views: 7.2ms | ActiveRecord: 0.3ms)When i updated the record the following logs are coming:
Started POST "/books/3" for 127.0.0.1 at 2011-02-24 12:35:15 +0200 Processing by BooksController#update as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"Qq27y38shDTjz/CitfiZYYKePvR0HGTO1DK7rzh8fuA=", "book"=>{"title"=>"updated book", "author"=>"updated book"}, "commit"=>"Update Book", "id"=>"3"} CACHE GET "Book:1/3" Memcached get: "Book:1/3" Memcached hit: "Book:1/3" SQL (0.1ms) BEGIN AREL (0.3ms) UPDATE
books
SETtitle
= 'updated book',author
= 'updated book',updated_at
= '2011-02-24 10:35:15' WHEREbooks
.id
= 3 add_object_to_primary_key_cache: [["id", 3]] #<Book id: 3, title: "updated book", author: "updated book", created_at: "2011-02-24 10:34:00", updated_at: "2011-02-24 10:35:15"> SERIALIZE OBJECT: #<Book id: 3, title: "updated book", author: "updated book", created_at: "2011-02-24 10:34:00", updated_at: "2011-02-24 10:35:15"> CACHE SET Book:1/id/3 = #<Book id: 3, title: "updated book", author: "updated book", created_at: "2011-02-24 10:34:00", updated_at: "2011-02-24 10:35:15"> Memcached add: "lock/Book:1/id/3" Memcached hit: "lock/Book:1/id/3" Memcached set: "Book:1/id/3" Memcached hit: "Book:1/id/3" Memcached delete: "lock/Book:1/id/3" Memcached hit: "lock/Book:1/id/3" SQL (69.4ms) COMMIT Redirected to http://0.0.0.0:3000/books/3 Completed 302 Found in 89msStarted GET "/books/3" for 127.0.0.1 at 2011-02-24 12:35:15 +0200 Processing by BooksController#show as HTML Parameters: {"id"=>"3"} CACHE GET "Book:1/3" Memcached get: "Book:1/3" Memcached hit: "Book:1/3" Rendered books/show.html.erb within layouts/application (33.6ms) Completed 200 OK in 46ms (Views: 38.6ms | ActiveRecord: 0.0ms)
as you can see last call made with "Book:1/3" key and old value returned.