Основы работы с Memcached

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    Favorites, Groups & Events

    Основы работы с Memcached - Presentation Transcript

    1. Основы работы с memcached в Rails Илья Заяц Санкт-Петербург, 2009
    2. Что же такое memcached? Хеш в оперативной памяти, доступный по сети
    3. А мне оно надо? Надо, если: • у вас больше одного rails-процесса • надоело «руками» чистить кеш • есть желание в будущем все легко и быстро масштабировать
    4. Да, у меня есть там пара рельсовых инстансов, и что? Сервер Rails Rails Rails Кеш Кеш Кеш Все устраивает?
    5. Да, у меня есть там пара рельсовых инстансов, и что? Сервер Rails Rails Rails memcached Вот теперь хорошо!
    6. Хорошо, а как с этим работать? 1. Установка sudo apt-get install memcached Darwin ports Source memcached.exe ;) 2. Настройка config.cache_store = :mem_cache_store config.cache_store = :mem_cache_store, { :namespace => 'awesome_app' }
    7. А что в коде-то писать? Rails.cache.write('answer', 42) Rails.cache.read('answer') Rails.cache.write('question', Question.first) Rails.cache.write('answer', 42, :expires_in => 15.minutes) Rails.cache.fetch('answer') {42}
    8. И как потом это все чистить? 1. Никто не отменял «ручной» чистки: Rails.cache.delete(‘answer’) 2. Параметр :expires_in 3. «Умные ключи» <% cache(answer) do %> => ‘/views/answers/1-20090524184826’ <% cache([question, answer]) do %> => ‘/views/questions/1-20081124132654/answers/1-20090524184826’
    9. И поможет? 1. Бенчмарки New Relic, Rack::Bug 2. Мониторирование нагрузки в production
    10. Спасибо за внимание! Заяц Илья somebody32@gmail.com Главный разработчик Планария (planary.ru)
    SlideShare Zeitgeist 2009

    + railsclubrailsclub Nominate

    custom

    444 views, 0 favs, 0 embeds more stats

    Railsclub SPB, 31 мая 2009, Илья Заяц

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 444
      • 444 on SlideShare
      • 0 from embeds
    • Comments 0
    • Favorites 0
    • Downloads 1
    Most viewed embeds

    more

    All embeds

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories