GithubHelp home page GithubHelp logo

Comments (2)

mperham avatar mperham commented on August 15, 2024

That's YAML. Dalli doesn't know anything about YAML. I suspect your system has a monkeypatch which is interfering with marshalling. Here's a similar operation working fine in my Rails 3 app:

ruby-1.9.2-p0 > Rails.cache.write('users', User.all)
 => true 
ruby-1.9.2-p0 > Rails.cache.read('users')
 => [#<User id: 1, email: "[email protected]", encrypted_password: "$2a$10$R6INBwVfimIIZ1PCb6mIXuX.c9jTD8Vb9VIEpWtZgd.W...", password_salt: "$2a$10$R6INBwVfimIIZ1PCb6mIXu", reset_password_token: nil, remember_token: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: "2010-09-27 15:10:55", updated_at: "2010-09-27 15:10:55">, #<User id: 2, email: "[email protected]", encrypted_password: "$2a$10$iFSl81NSFl9SAvpI.isgreBEvmLhy4NKEttqnB8dWGGO...", password_salt: "$2a$10$iFSl81NSFl9SAvpI.isgre", reset_password_token: nil, remember_token: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: "2010-09-27 15:11:28", updated_at: "2010-09-27 15:11:28">]
ruby-1.9.2-p0 > Rails.cache.instance_variable_get :@data
 => #<Dalli::Client:0x00000100f95938 @servers=["localhost:11211"], @options={}>

from dalli.

guivinicius avatar guivinicius commented on August 15, 2024

Yeah! .. In console works fine too.

But if I try to use the object in controller/view ... return me the strange thing.

If I do in my controller

dc = Dalli::Client.new
dc.set('presidentes', Candidato.by_cargo(:key => "Presidente"))

@presidentes = dc.get('presidentes')

Works fine! But ... is not the right thing to do. =/

from dalli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.