dalli

    0熱度

    1回答

    我正在嘗試讀Rails.cache中設置的緩存值,我正在使用rails 3.1和使用dalli。 當我執行這一塊我收到一些不需要的字符響應 這裏是代碼塊 @total_count = Rails.cache.fetch(count_key){ connection.select_rows("select FOUND_ROWS()").first.first.to_s } 和我得到的

    -1熱度

    1回答

    我剛開始在生產應用程序中使用緩存來加快速度。我已經閱讀了主要的Rails指南,各種博客,源碼本身等等。但就片段緩存而言,我的頭仍不清楚一件簡單的事情: 當您在更新對象後銷燬緩存時,你只更新單個對象還是該類?我認爲只是單一的對象。 下面是一個例子: <% @jobs.each do |job| %> <% cache("jobs_index_table_environment_#{sess

    3熱度

    2回答

    我使用: Rails 4.1.0rc2 Heroku gem 'memcachier' gem 'dalli' 如果我使用緩存從控制檯,它的工作原理: irb(main):010:0> Rails.cache.write("foo", "bar") => 1297036692682702848 irb(main):011:0> Rails.cache.read("foo") => "bar"

    0熱度

    1回答

    我有一個使用memcached和dalli實現緩存的rails應用程序。 我存儲的散列結果這樣 Rails.cache.write("home_stays[#{home_stay['id']}]", home_stay, expires_in: 5.minutes) 我可以用它的ID特定寄宿獲取價值。 我很困惑的是如何從緩存中獲得所有的寄宿家庭。 如果我運行Rails.cache.fetch(

    0熱度

    1回答

    我無法緩存大型ActiveRecord對象。有了小的它的確定: sel = Car.select("id, `key`, value").limit(1000) Rails.cache.write('miauuu', sel) => true 但是,如果他們得到一個大一點: sel = Car.select("id, `key`, value").limit(10000) Rails.c

    0熱度

    1回答

    我在我的Rails應用程序了查詢並不需要很長時間來運行(〜180ms的),但不會返回了不少成果。結果在API中使用,結果轉換爲JSON的代價很高(大約3秒)。爲了加快速度,我這樣緩存: key = 'new_prices' query = Prices.new_this_month.where('...') json = cache(key, expires_in: 60.minutes) d

    0熱度

    2回答

    當我嘗試將內存中的對象保存到數據庫,然後使用Dalli緩存該對象時,出現奇怪的行爲。 class Infraction << ActiveRecord::Base has_many :infraction_locations has_many :tracked_points, through: :infraction_locations end class Tracked

    1熱度

    1回答

    我試圖在我的rspec場景中使用Rails.cache.read和Rails.cache.write helpers,但它不起作用。我正在使用dalli_store進行緩存存儲。 我在任何隨機測試場景中寫道 ActionController::Base.perform_caching = true ,然後運行僅此rspec的。當我跳到下一行的斷點,並嘗試在控制檯 Rails.cache.wri

    0熱度

    1回答

    當我嘗試緩存具有has_many through:關係的ActiveRecord對象時,我無法緩存該對象,除非我重新加載或保存該對象。 person.rb: class Person < ActiveRecord::Base attr_accessible :name has_many :person_locations has_many :locations, t

    1熱度

    1回答

    我正在使用Ruby on Rails和dalli gem來執行與memcache的緩存。 默認值(鍵值存儲中的值,也稱爲板)最大大小爲1MB。 我想增加到2MB。 The documentation of dalli說: value_max_bytes: The maximum size of a value in memcached. Defaults to 1MB, this can be i