SlideShare a Scribd company logo
Основы работы с memcached в
           Rails
           Илья Заяц
      Санкт-Петербург, 2009
Что же такое memcached?


 Хеш в оперативной памяти,
     доступный по сети
А мне оно надо?

             Надо, если:
• у вас больше одного rails-процесса
• надоело «руками» чистить кеш
• есть желание в будущем все легко
и быстро масштабировать
Да, у меня есть там пара
рельсовых инстансов, и что?

                Сервер




    Rails        Rails        Rails




    Кеш          Кеш          Кеш




            Все устраивает?
Да, у меня есть там пара
рельсовых инстансов, и что?

                 Сервер




    Rails         Rails          Rails




                memcached




            Вот теперь хорошо!
Хорошо, а как с этим работать?

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' }
А что в коде-то писать?

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}
И как потом это все чистить?

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’
И поможет?

1. Бенчмарки
New Relic, Rack::Bug

2. Мониторирование     нагрузки в production
Спасибо за внимание!

Заяц Илья
somebody32@gmail.com

Главный разработчик Планария (planary.ru)

More Related Content

Viewers also liked

h2h.. a marketing workshop pedagogy, customized for the MSME sector
h2h.. a marketing workshop pedagogy, customized for the MSME sectorh2h.. a marketing workshop pedagogy, customized for the MSME sector
h2h.. a marketing workshop pedagogy, customized for the MSME sector
Manosh R. Sengupta -raconteur of stories on people and brands
 
15. Forum Mobilności, Marek Bauer - Wydzielone pasy dla komunikacji zbiorowej...
15. Forum Mobilności, Marek Bauer - Wydzielone pasy dla komunikacji zbiorowej...15. Forum Mobilności, Marek Bauer - Wydzielone pasy dla komunikacji zbiorowej...
15. Forum Mobilności, Marek Bauer - Wydzielone pasy dla komunikacji zbiorowej...krakoff
 
Thc 周年庆致词
Thc 周年庆致词Thc 周年庆致词
Thc 周年庆致词shthc
 
I18n ruby-приложений
I18n ruby-приложенийI18n ruby-приложений
I18n ruby-приложений
railsclub
 
Odpowiedz ZIKiT'u w sprawie drzew w al. 3 Maja w Krakowie
Odpowiedz ZIKiT'u w sprawie drzew w al. 3 Maja w KrakowieOdpowiedz ZIKiT'u w sprawie drzew w al. 3 Maja w Krakowie
Odpowiedz ZIKiT'u w sprawie drzew w al. 3 Maja w Krakowiekrakoff
 
Some Answers About Techno Pedagogical Design As Aspect
Some Answers About Techno Pedagogical Design As AspectSome Answers About Techno Pedagogical Design As Aspect
Some Answers About Techno Pedagogical Design As Aspectguestf9db3f
 
Projekt Muzeum Konfederacji Barskiej, Lapidarium I Parkingu Winnica
Projekt Muzeum Konfederacji Barskiej, Lapidarium I Parkingu   WinnicaProjekt Muzeum Konfederacji Barskiej, Lapidarium I Parkingu   Winnica
Projekt Muzeum Konfederacji Barskiej, Lapidarium I Parkingu Winnica
krakoff
 
Integration / Acceptance тестирование с помощью Cucumber
Integration / Acceptance тестирование с помощью CucumberIntegration / Acceptance тестирование с помощью Cucumber
Integration / Acceptance тестирование с помощью Cucumber
railsclub
 
Digital trends and us
Digital trends and usDigital trends and us
Sms Diffsion Of Info
Sms   Diffsion Of InfoSms   Diffsion Of Info
Polityka Transportowa, Olaf Swolkień
Polityka Transportowa, Olaf SwolkieńPolityka Transportowa, Olaf Swolkień
Polityka Transportowa, Olaf Swolkieńkrakoff
 
Wiesław Dźwigoń, Łukasz Franek - Politechnika Krakowska - Prezentacja Forum M...
Wiesław Dźwigoń, Łukasz Franek - Politechnika Krakowska - Prezentacja Forum M...Wiesław Dźwigoń, Łukasz Franek - Politechnika Krakowska - Prezentacja Forum M...
Wiesław Dźwigoń, Łukasz Franek - Politechnika Krakowska - Prezentacja Forum M...
krakoff
 
Mayo clinic
Mayo clinicMayo clinic
Amidst a world of choices
Amidst a world of choicesAmidst a world of choices

Viewers also liked (18)

h2h.. a marketing workshop pedagogy, customized for the MSME sector
h2h.. a marketing workshop pedagogy, customized for the MSME sectorh2h.. a marketing workshop pedagogy, customized for the MSME sector
h2h.. a marketing workshop pedagogy, customized for the MSME sector
 
Labour Pains... a presentation to PR Hub (Dec 2014)
Labour Pains... a presentation to PR Hub (Dec 2014)Labour Pains... a presentation to PR Hub (Dec 2014)
Labour Pains... a presentation to PR Hub (Dec 2014)
 
15. Forum Mobilności, Marek Bauer - Wydzielone pasy dla komunikacji zbiorowej...
15. Forum Mobilności, Marek Bauer - Wydzielone pasy dla komunikacji zbiorowej...15. Forum Mobilności, Marek Bauer - Wydzielone pasy dla komunikacji zbiorowej...
15. Forum Mobilności, Marek Bauer - Wydzielone pasy dla komunikacji zbiorowej...
 
Thc 周年庆致词
Thc 周年庆致词Thc 周年庆致词
Thc 周年庆致词
 
I18n ruby-приложений
I18n ruby-приложенийI18n ruby-приложений
I18n ruby-приложений
 
Odpowiedz ZIKiT'u w sprawie drzew w al. 3 Maja w Krakowie
Odpowiedz ZIKiT'u w sprawie drzew w al. 3 Maja w KrakowieOdpowiedz ZIKiT'u w sprawie drzew w al. 3 Maja w Krakowie
Odpowiedz ZIKiT'u w sprawie drzew w al. 3 Maja w Krakowie
 
Some Answers About Techno Pedagogical Design As Aspect
Some Answers About Techno Pedagogical Design As AspectSome Answers About Techno Pedagogical Design As Aspect
Some Answers About Techno Pedagogical Design As Aspect
 
Projekt Muzeum Konfederacji Barskiej, Lapidarium I Parkingu Winnica
Projekt Muzeum Konfederacji Barskiej, Lapidarium I Parkingu   WinnicaProjekt Muzeum Konfederacji Barskiej, Lapidarium I Parkingu   Winnica
Projekt Muzeum Konfederacji Barskiej, Lapidarium I Parkingu Winnica
 
Integration / Acceptance тестирование с помощью Cucumber
Integration / Acceptance тестирование с помощью CucumberIntegration / Acceptance тестирование с помощью Cucumber
Integration / Acceptance тестирование с помощью Cucumber
 
Vision Mission Breaking The Joojoo
Vision Mission   Breaking The JoojooVision Mission   Breaking The Joojoo
Vision Mission Breaking The Joojoo
 
Digital trends and us
Digital trends and usDigital trends and us
Digital trends and us
 
Sms Diffsion Of Info
Sms   Diffsion Of InfoSms   Diffsion Of Info
Sms Diffsion Of Info
 
Polityka Transportowa, Olaf Swolkień
Polityka Transportowa, Olaf SwolkieńPolityka Transportowa, Olaf Swolkień
Polityka Transportowa, Olaf Swolkień
 
Wiesław Dźwigoń, Łukasz Franek - Politechnika Krakowska - Prezentacja Forum M...
Wiesław Dźwigoń, Łukasz Franek - Politechnika Krakowska - Prezentacja Forum M...Wiesław Dźwigoń, Łukasz Franek - Politechnika Krakowska - Prezentacja Forum M...
Wiesław Dźwigoń, Łukasz Franek - Politechnika Krakowska - Prezentacja Forum M...
 
Quo Vadis Agencies
Quo Vadis AgenciesQuo Vadis Agencies
Quo Vadis Agencies
 
Mayo clinic
Mayo clinicMayo clinic
Mayo clinic
 
In search of my feminine
In search of my feminineIn search of my feminine
In search of my feminine
 
Amidst a world of choices
Amidst a world of choicesAmidst a world of choices
Amidst a world of choices
 

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

тупицын Ec2 Rootconf2009
тупицын Ec2 Rootconf2009тупицын Ec2 Rootconf2009
тупицын Ec2 Rootconf2009Liudmila Li
 
Как сделать контрибут в Ruby on Rails
Как сделать контрибут в Ruby on RailsКак сделать контрибут в Ruby on Rails
Как сделать контрибут в Ruby on Rails
Yaroslav Markin
 
Что такое ASP.NET MVC?
Что такое ASP.NET MVC?Что такое ASP.NET MVC?
Что такое ASP.NET MVC?
Dima Pasko
 
Ruby on Rails at HackDay in Saint Petersburg
Ruby on Rails at HackDay in Saint PetersburgRuby on Rails at HackDay in Saint Petersburg
Ruby on Rails at HackDay in Saint Petersburg
Alexander Krass
 
Intro To RDBMS And SQL Server 2005 - Svetlin Nakov
Intro To RDBMS And SQL Server 2005 - Svetlin NakovIntro To RDBMS And SQL Server 2005 - Svetlin Nakov
Intro To RDBMS And SQL Server 2005 - Svetlin NakovSvetlin Nakov
 
за Ruby
за Rubyза Ruby
за Ruby
Stefan Kanev
 
P2 P Mobile Advertising And Targeting
P2 P Mobile Advertising And TargetingP2 P Mobile Advertising And Targeting
P2 P Mobile Advertising And Targetingguest258f78a
 
P2P Bug Tracking with SD
P2P Bug Tracking with SDP2P Bug Tracking with SD
P2P Bug Tracking with SD
Jesse Vincent
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
SSA KPI
 
Как построить лучший корпоративный Университет (по версии CUX). Опыт и рекоме...
Как построить лучший корпоративный Университет (по версии CUX). Опыт и рекоме...Как построить лучший корпоративный Университет (по версии CUX). Опыт и рекоме...
Как построить лучший корпоративный Университет (по версии CUX). Опыт и рекоме...
Vitaliy Mazurenko
 
Защо Ruby on Rails
Защо Ruby on RailsЗащо Ruby on Rails
Защо Ruby on Rails
Stefan Kanev
 
Jazz – открытая платформа разработки ПО
Jazz – открытая платформа разработки ПОJazz – открытая платформа разработки ПО
Jazz – открытая платформа разработки ПО
SQALab
 
query optimization
query optimizationquery optimization
query optimizationDimara Hakim
 
Groovy Vs Perl
Groovy Vs PerlGroovy Vs Perl
Groovy Vs Perl
mayperl
 
Ruby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese VersionRuby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese VersionLibin Pan
 

Similar to Основы работы с Memcached (20)

тупицын Ec2 Rootconf2009
тупицын Ec2 Rootconf2009тупицын Ec2 Rootconf2009
тупицын Ec2 Rootconf2009
 
Как сделать контрибут в Ruby on Rails
Как сделать контрибут в Ruby on RailsКак сделать контрибут в Ruby on Rails
Как сделать контрибут в Ruby on Rails
 
Что такое ASP.NET MVC?
Что такое ASP.NET MVC?Что такое ASP.NET MVC?
Что такое ASP.NET MVC?
 
20070613 Rit2007 Training
20070613 Rit2007 Training20070613 Rit2007 Training
20070613 Rit2007 Training
 
20070329 Phpconf2007 Training
20070329 Phpconf2007 Training20070329 Phpconf2007 Training
20070329 Phpconf2007 Training
 
Cisco Security and Crisis
Cisco Security and CrisisCisco Security and Crisis
Cisco Security and Crisis
 
Ruby on Rails at HackDay in Saint Petersburg
Ruby on Rails at HackDay in Saint PetersburgRuby on Rails at HackDay in Saint Petersburg
Ruby on Rails at HackDay in Saint Petersburg
 
Intro To RDBMS And SQL Server 2005 - Svetlin Nakov
Intro To RDBMS And SQL Server 2005 - Svetlin NakovIntro To RDBMS And SQL Server 2005 - Svetlin Nakov
Intro To RDBMS And SQL Server 2005 - Svetlin Nakov
 
за Ruby
за Rubyза Ruby
за Ruby
 
P2 P Mobile Advertising And Targeting
P2 P Mobile Advertising And TargetingP2 P Mobile Advertising And Targeting
P2 P Mobile Advertising And Targeting
 
Why Ror
Why RorWhy Ror
Why Ror
 
P2P Bug Tracking with SD
P2P Bug Tracking with SDP2P Bug Tracking with SD
P2P Bug Tracking with SD
 
Hackday Ml
Hackday MlHackday Ml
Hackday Ml
 
Cloud Computing
Cloud ComputingCloud Computing
Cloud Computing
 
Как построить лучший корпоративный Университет (по версии CUX). Опыт и рекоме...
Как построить лучший корпоративный Университет (по версии CUX). Опыт и рекоме...Как построить лучший корпоративный Университет (по версии CUX). Опыт и рекоме...
Как построить лучший корпоративный Университет (по версии CUX). Опыт и рекоме...
 
Защо Ruby on Rails
Защо Ruby on RailsЗащо Ruby on Rails
Защо Ruby on Rails
 
Jazz – открытая платформа разработки ПО
Jazz – открытая платформа разработки ПОJazz – открытая платформа разработки ПО
Jazz – открытая платформа разработки ПО
 
query optimization
query optimizationquery optimization
query optimization
 
Groovy Vs Perl
Groovy Vs PerlGroovy Vs Perl
Groovy Vs Perl
 
Ruby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese VersionRuby on Rails 2.1 What's New Chinese Version
Ruby on Rails 2.1 What's New Chinese Version
 

Recently uploaded

SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
Peter Spielvogel
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
SOFTTECHHUB
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
RinaMondal9
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
UiPathCommunity
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
Jen Stirrup
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 

Recently uploaded (20)

SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfSAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Assure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyesAssure Contact Center Experiences for Your Customers With ThousandEyes
Assure Contact Center Experiences for Your Customers With ThousandEyes
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Free Complete Python - A step towards Data Science
Free Complete Python - A step towards Data ScienceFree Complete Python - A step towards Data Science
Free Complete Python - A step towards Data Science
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...The Metaverse and AI: how can decision-makers harness the Metaverse for their...
The Metaverse and AI: how can decision-makers harness the Metaverse for their...
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 

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

  • 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)