# Multiple log entries when using Rails.cache

**URL:** <https://www.ruby-forum.com/t/multiple-log-entries-when-using-rails-cache/165773>\
**Category:** Rails\
**Created:** [April 17, 2009, 10:32am UTC](https://www.ruby-forum.com/t/multiple-log-entries-when-using-rails-cache/165773 "2009-04-17T10:32:08Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![whitespace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/f19dbf/32.png) [@whitespace](https://www.ruby-forum.com/u/whitespace)\
**Post date:** [April 17, 2009, 10:32am UTC](https://www.ruby-forum.com/t/multiple-log-entries-when-using-rails-cache/165773/1 "2009-04-17T10:32:08Z")

</div>

I’ve started using Rails.cache, specially Rails.cache.fetch. This gives  
me some log entries I’m a little curious about - I hope someone can poke  
me in the right direction.

Examples:

1. 

Rails.cache.write(‘testing’, ‘test value’)  
Rails.cache.read(‘testing’)

Gives these log entries:

Cache write: testing  
Cache write: testing  
Cache read: testing  
( Why the two writes? )

1. 

Rails.cache.fetch(‘testing’) { ‘test value’ }

Gives these log entries:

Cache read: testing  
Cache write: testing  
Cache miss: testing ({})  
Cache write: testing  
Cache write (will save 0.00ms): testing  
( Miss after it is writtin? And then to extra writes? )

Best regards  
Rudi

---

<div class="post-metadata">

**Author:** ![whitespace](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/f19dbf/32.png) [@whitespace](https://www.ruby-forum.com/u/whitespace)\
**Post date:** [April 20, 2009, 4:13pm UTC](https://www.ruby-forum.com/t/multiple-log-entries-when-using-rails-cache/165773/2 "2009-04-20T16:13:40Z")

</div>

I’ve narrowed it down to situations when memcache store is used.

I think somehow the @logger\_off property in active\_supports cache.rb is  
ignored when used with memcache?

Have anybody else experienced something similar?

Regards  
Rudi
