SlideShare a Scribd company logo
REST Services: HTTP caching
“A distributed system is one in which the failure
of a computer you didn’t even know existed can
render your own computer unusable.”
- Leslie Lamport
• REST stands for REpresentational State Transfer
• Representation is just a very simple rendering
of the object
• Has benefits when leverages existing HTTP
protocol
What is REST?
• Up-to-date
• Fresh
• Stale
States of Resource Representation
Up-to-Date state means the Representation is
current according to the origin server
Representation is being sent back with no expiry
and no caching instructions means the client is
allowed to cache for however long or not cache
at all
Up-to-Date State
Fresh State considered as long as the
Representation hasn’t expired at client side,
proxy or browser
Fresh State
• Sending must-revalidate means the client must
revalidate once the representation is Stale
• Stale means it’s gone over it’s expiration date
Stale State
• Doesn’t actually mean do not cache
• Means the client must revalidate both Fresh
and Stale entries and then may use the cached
copy if it’s up to date
No-cache Directive
• In plain English text format
• Starting line: Method URI
HTTP/version
• Headers
• Body
HTTP Message
Request:
GET /wiki HTTP/1.1
Host: wikipedia.org
Accept: text/html
Connection: close
Response:
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Content-Language: en
Content-Length: 1234
Sample HTTP Request/Response
• Get
• Post
• Put
• Delete
• Options
• Head
• Patch
• Trace
• Link
• Unlink
• Connect
Cache-enabled methods are in Red
HTTP Methods
Response:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1234
Expires: Fri, 27 Jan 2012 02:33:12 GMT
•Allows only HTTP date
•Good for static resources
•Limited control
HTTP Expires header
• Enough for static content
• For things that rarely change
• Or don’t change at all like Calculator
/Calculator/Multiply?x=2&y=2/Calculator/Multiply?x=2&y=2 ClientClient
Expires is Enough?
• public
• private
• no-cache
• no-store
• max-age=[seconds]
• s-maxage=[seconds]
• must-revalidate
• proxy-revalidate
• no-transform
HTTP Cache-Control directives
Response:
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 1234
Cache-Control: max-age=3600, must-revalidate
HTTP Cache-Control Sample
What if we need to update data?
Cache-Control is Enough for REST
• Optimistic is when we version our data
• And do not have any transactions
• Make use of ETag, If-Match and If-None-
Match headers
Optimistic Locking: ETag
/Orders/Orders ClientClient
GET /Orders HTTP/1.1
HTTP/1.1 200 OK
Etag: 1
[content goes in body]
GET /Orders HTTP/1.1
If-None-Match: 1
HTTP/1.1 304 Not Modified
[no ETag]
[no content returned!]
ETag: GET Not Modified Resource
/Orders/Orders ClientClient
GET /Orders HTTP/1.1
HTTP/1.1 200 OK
Etag: 1
[content goes in body]
GET /Orders HTTP/1.1
If-None-Match: 1
HTTP/1.1 200 OK
Etag: 2
[new content goes in body!]
ETag: GET modified resource
/Orders/Orders ClientClient
HTTP/1.1 200 OK
Etag: 1
[content goes in body]
PUT /Orders HTTP/1.1
If-Match: 1
[new content goes in body]
HTTP/1.1 100 Continue
[no ETag]
[no content!]
GET /Orders HTTP/1.1
ETag: Modify Resource (PUT)
/Orders/Orders ClientClient
HTTP/1.1 200 OK
Etag: 1
[content goes in body]
PUT /Orders HTTP/1.1
If-Match: 1
[new content goes in body]
HTTP/1.1 412 Precondition Failed
[no ETag]
[no content!]
GET /Orders HTTP/1.1
ETag: Modify Changed Resource (PUT)
God damned HTTP!
What we gonna do?
• Override changes!
• Yeah! It’s possible!
• Download the latest version using GET method
• We will know the new Etag then
Etag: mismatch when PUT
/Orders/Orders ClientClient
HTTP/1.1 412 Precondition Failed
[no ETag]
[no content!]
PUT /Orders HTTP/1.1
If-None-Match: 1
[new content goes in body]
HTTP/1.1 100 Continue
[no ETag]
[no content!]
PUT /Orders HTTP/1.1
If-Match: 1
[new content goes in body]
Etag: Override Changes When PUT
• ETag and If-* headers came with HTTP 1.1
• In HTTP 1.0 there are another set of headers:
Last-Modified: Sat, 29 Oct 2011 19:43:31 GMT
If-Modified-Since: Sat, 29 Oct 2011 19:43:31
GMT
Additional HTTP Headers
int Multiply(int x, int y)int Multiply(int x, int y)
HTTPHTTP
IPC (Named Pipes)IPC (Named Pipes)
TCPTCP
ClientClient
TCPTCP
SOAPSOAP
UDPUDP
Web Services: Protocols
POST /search HTTP/1.1
Host: www.domain.com
Content-Type: application/x-www-form-
urlencoded
term=something
HTTP/1.1 303 See Other
Location: /search/something/1
POST-Redirect-GET pattern
Rest services caching
Rest services caching

More Related Content

What's hot

Website performance optimization QA
Website performance optimization QAWebsite performance optimization QA
Website performance optimization QA
Denis Dudaev
 
Rest api design by george reese
Rest api design by george reeseRest api design by george reese
Rest api design by george reese
buildacloud
 
Caching on the web
Caching on the webCaching on the web
Caching on the web
Jean Carlo Emer
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
Bud Siddhisena
 
Fluent 2012 v2
Fluent 2012   v2Fluent 2012   v2
Fluent 2012 v2
Shalendra Chhabra
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
Christopher Bartling
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And Scalability
Jason Ragsdale
 
WordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningWordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & Tuning
Timothy Wood
 
CFML Sessions For Dummies
CFML Sessions For DummiesCFML Sessions For Dummies
CFML Sessions For Dummies
ColdFusionConference
 
Caching 101
Caching 101Caching 101
Caching 101
Andy Melichar
 
How to improve your apache web server’s performance
How to improve your apache web server’s performanceHow to improve your apache web server’s performance
How to improve your apache web server’s performance
Andolasoft Inc
 
High Performance - Joomla!Days NL 2009 #jd09nl
High Performance - Joomla!Days NL 2009 #jd09nlHigh Performance - Joomla!Days NL 2009 #jd09nl
High Performance - Joomla!Days NL 2009 #jd09nl
Joomla!Days Netherlands
 
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
Amazon Web Services
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & Acceleration
NGINX, Inc.
 
Choosing a Web Architecture for Perl
Choosing a Web Architecture for PerlChoosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
Perrin Harkins
 
Skalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSkalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.com
Spodek 2.0
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with Elasticsearch
Taylor Lovett
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
WordCamp Cape Town
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
Anam Ahmed
 
Less and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersLess and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developers
Seravo
 

What's hot (20)

Website performance optimization QA
Website performance optimization QAWebsite performance optimization QA
Website performance optimization QA
 
Rest api design by george reese
Rest api design by george reeseRest api design by george reese
Rest api design by george reese
 
Caching on the web
Caching on the webCaching on the web
Caching on the web
 
Scale Apache with Nginx
Scale Apache with NginxScale Apache with Nginx
Scale Apache with Nginx
 
Fluent 2012 v2
Fluent 2012   v2Fluent 2012   v2
Fluent 2012 v2
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
Web Speed And Scalability
Web Speed And ScalabilityWeb Speed And Scalability
Web Speed And Scalability
 
WordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & TuningWordCamp RVA 2011 - Performance & Tuning
WordCamp RVA 2011 - Performance & Tuning
 
CFML Sessions For Dummies
CFML Sessions For DummiesCFML Sessions For Dummies
CFML Sessions For Dummies
 
Caching 101
Caching 101Caching 101
Caching 101
 
How to improve your apache web server’s performance
How to improve your apache web server’s performanceHow to improve your apache web server’s performance
How to improve your apache web server’s performance
 
High Performance - Joomla!Days NL 2009 #jd09nl
High Performance - Joomla!Days NL 2009 #jd09nlHigh Performance - Joomla!Days NL 2009 #jd09nl
High Performance - Joomla!Days NL 2009 #jd09nl
 
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
Dynamic Content Acceleration: Amazon CloudFront and Amazon Route 53 (ARC309) ...
 
NGINX for Application Delivery & Acceleration
NGINX for Application Delivery & AccelerationNGINX for Application Delivery & Acceleration
NGINX for Application Delivery & Acceleration
 
Choosing a Web Architecture for Perl
Choosing a Web Architecture for PerlChoosing a Web Architecture for Perl
Choosing a Web Architecture for Perl
 
Skalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.comSkalowalna architektura na przykładzie soccerway.com
Skalowalna architektura na przykładzie soccerway.com
 
Modernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with ElasticsearchModernizing WordPress Search with Elasticsearch
Modernizing WordPress Search with Elasticsearch
 
Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)Roy foubister (hosting high traffic sites on a tight budget)
Roy foubister (hosting high traffic sites on a tight budget)
 
WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019WordPress At Scale. WordCamp Dhaka 2019
WordPress At Scale. WordCamp Dhaka 2019
 
Less and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developersLess and faster – Cache tips for WordPress developers
Less and faster – Cache tips for WordPress developers
 

Viewers also liked

API Caching, why your server needs some rest
API Caching, why your server needs some restAPI Caching, why your server needs some rest
API Caching, why your server needs some rest
Luis Cipriani
 
Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
 Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва  Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
it-people
 
HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011
Alessandro Nadalin
 
ePUB in brief
ePUB in briefePUB in brief
ePUB in brief
Sean Lee
 
Spring data
Spring dataSpring data
Spring data
Sean Lee
 
Cloud foundry practice
Cloud foundry practiceCloud foundry practice
Cloud foundry practice
Sean Lee
 
Caching Strategies
Caching StrategiesCaching Strategies
Caching Strategies
Michal Špaček
 
REST and Microservices
REST and MicroservicesREST and Microservices
REST and Microservices
Shaun Abram
 
Fearless HTTP requests abuse
Fearless HTTP requests abuseFearless HTTP requests abuse
Fearless HTTP requests abuse
Luis Cipriani
 

Viewers also liked (9)

API Caching, why your server needs some rest
API Caching, why your server needs some restAPI Caching, why your server needs some rest
API Caching, why your server needs some rest
 
Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
 Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва  Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
Реактивный кэш в Android, Андрей Мельников, Rambler&Co, Москва
 
HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011HTTP cache @ PUG Rome 03-29-2011
HTTP cache @ PUG Rome 03-29-2011
 
ePUB in brief
ePUB in briefePUB in brief
ePUB in brief
 
Spring data
Spring dataSpring data
Spring data
 
Cloud foundry practice
Cloud foundry practiceCloud foundry practice
Cloud foundry practice
 
Caching Strategies
Caching StrategiesCaching Strategies
Caching Strategies
 
REST and Microservices
REST and MicroservicesREST and Microservices
REST and Microservices
 
Fearless HTTP requests abuse
Fearless HTTP requests abuseFearless HTTP requests abuse
Fearless HTTP requests abuse
 

Similar to Rest services caching

Interactive web. O rly?
Interactive web. O rly?Interactive web. O rly?
Interactive web. O rly?
timbc
 
Http smuggling 1 200523064027
Http smuggling 1 200523064027Http smuggling 1 200523064027
Http smuggling 1 200523064027
n|u - The Open Security Community
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request Smuggling
Akash Ashokan
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
Sahil Agarwal
 
RESTful APIs
RESTful APIsRESTful APIs
RESTful APIs
Adi Challa
 
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to know
Gökhan Şengün
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
Mahek Merchant
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
Cory Forsyth
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
Hoan Vu Tran
 
Rest APIs Training
Rest APIs TrainingRest APIs Training
Rest APIs Training
Shekhar Kumar
 
Browser
BrowserBrowser
Browser
Shweta Oza
 
21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards
Denis Ristic
 
Rest webservice ppt
Rest webservice pptRest webservice ppt
Rest webservice ppt
sinhatanay
 
SFDC Outbound Integrations
SFDC Outbound IntegrationsSFDC Outbound Integrations
SFDC Outbound Integrations
Sujit Kumar
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
Jeelani Shaik
 
HTTP
HTTPHTTP
Understanding the Web through HTTP
Understanding the Web through HTTPUnderstanding the Web through HTTP
Understanding the Web through HTTP
Olivia Brundage
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 Mean
Alex Theedom
 
restapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdfrestapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdf
mrle7
 
Rest API Testing
Rest API TestingRest API Testing
Rest API Testing
upadhyay_25
 

Similar to Rest services caching (20)

Interactive web. O rly?
Interactive web. O rly?Interactive web. O rly?
Interactive web. O rly?
 
Http smuggling 1 200523064027
Http smuggling 1 200523064027Http smuggling 1 200523064027
Http smuggling 1 200523064027
 
HTTP Request Smuggling
HTTP Request SmugglingHTTP Request Smuggling
HTTP Request Smuggling
 
HTTP request and response
HTTP request and responseHTTP request and response
HTTP request and response
 
RESTful APIs
RESTful APIsRESTful APIs
RESTful APIs
 
Http - All you need to know
Http - All you need to knowHttp - All you need to know
Http - All you need to know
 
Rest WebAPI with OData
Rest WebAPI with ODataRest WebAPI with OData
Rest WebAPI with OData
 
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
HTTP by Hand: Exploring HTTP/1.0, 1.1 and 2.0
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
 
Rest APIs Training
Rest APIs TrainingRest APIs Training
Rest APIs Training
 
Browser
BrowserBrowser
Browser
 
21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards21 HTTP Protocol #burningkeyboards
21 HTTP Protocol #burningkeyboards
 
Rest webservice ppt
Rest webservice pptRest webservice ppt
Rest webservice ppt
 
SFDC Outbound Integrations
SFDC Outbound IntegrationsSFDC Outbound Integrations
SFDC Outbound Integrations
 
REST API Recommendations
REST API RecommendationsREST API Recommendations
REST API Recommendations
 
HTTP
HTTPHTTP
HTTP
 
Understanding the Web through HTTP
Understanding the Web through HTTPUnderstanding the Web through HTTP
Understanding the Web through HTTP
 
Java EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 MeanJava EE 8: What Servlet 4 and HTTP2 Mean
Java EE 8: What Servlet 4 and HTTP2 Mean
 
restapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdfrestapitest-anil-200517181251.pdf
restapitest-anil-200517181251.pdf
 
Rest API Testing
Rest API TestingRest API Testing
Rest API Testing
 

More from Sperasoft

особенности работы с Locomotion в Unreal Engine 4
особенности работы с Locomotion в Unreal Engine 4особенности работы с Locomotion в Unreal Engine 4
особенности работы с Locomotion в Unreal Engine 4
Sperasoft
 
концепт и архитектура геймплея в Creach: The Depleted World
концепт и архитектура геймплея в Creach: The Depleted Worldконцепт и архитектура геймплея в Creach: The Depleted World
концепт и архитектура геймплея в Creach: The Depleted World
Sperasoft
 
Опыт разработки VR игры для UE4
Опыт разработки VR игры для UE4Опыт разработки VR игры для UE4
Опыт разработки VR игры для UE4
Sperasoft
 
Организация работы с UE4 в команде до 20 человек
Организация работы с UE4 в команде до 20 человек Организация работы с UE4 в команде до 20 человек
Организация работы с UE4 в команде до 20 человек
Sperasoft
 
Gameplay Tags
Gameplay TagsGameplay Tags
Gameplay Tags
Sperasoft
 
Data Driven Gameplay in UE4
Data Driven Gameplay in UE4Data Driven Gameplay in UE4
Data Driven Gameplay in UE4
Sperasoft
 
Code and Memory Optimisation Tricks
Code and Memory Optimisation Tricks Code and Memory Optimisation Tricks
Code and Memory Optimisation Tricks
Sperasoft
 
The theory of relational databases
The theory of relational databasesThe theory of relational databases
The theory of relational databases
Sperasoft
 
Automated layout testing using Galen Framework
Automated layout testing using Galen FrameworkAutomated layout testing using Galen Framework
Automated layout testing using Galen Framework
Sperasoft
 
Sperasoft talks: Android Security Threats
Sperasoft talks: Android Security ThreatsSperasoft talks: Android Security Threats
Sperasoft talks: Android Security Threats
Sperasoft
 
Sperasoft Talks: RxJava Functional Reactive Programming on Android
Sperasoft Talks: RxJava Functional Reactive Programming on AndroidSperasoft Talks: RxJava Functional Reactive Programming on Android
Sperasoft Talks: RxJava Functional Reactive Programming on Android
Sperasoft
 
Sperasoft‬ talks j point 2015
Sperasoft‬ talks j point 2015Sperasoft‬ talks j point 2015
Sperasoft‬ talks j point 2015
Sperasoft
 
Effective Мeetings
Effective МeetingsEffective Мeetings
Effective Мeetings
Sperasoft
 
Unreal Engine 4 Introduction
Unreal Engine 4 IntroductionUnreal Engine 4 Introduction
Unreal Engine 4 Introduction
Sperasoft
 
JIRA Development
JIRA DevelopmentJIRA Development
JIRA Development
Sperasoft
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
Sperasoft
 
MOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JSMOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JS
Sperasoft
 
Quick Intro Into Kanban
Quick Intro Into KanbanQuick Intro Into Kanban
Quick Intro Into Kanban
Sperasoft
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 Review
Sperasoft
 
Console Development in 15 minutes
Console Development in 15 minutesConsole Development in 15 minutes
Console Development in 15 minutes
Sperasoft
 

More from Sperasoft (20)

особенности работы с Locomotion в Unreal Engine 4
особенности работы с Locomotion в Unreal Engine 4особенности работы с Locomotion в Unreal Engine 4
особенности работы с Locomotion в Unreal Engine 4
 
концепт и архитектура геймплея в Creach: The Depleted World
концепт и архитектура геймплея в Creach: The Depleted Worldконцепт и архитектура геймплея в Creach: The Depleted World
концепт и архитектура геймплея в Creach: The Depleted World
 
Опыт разработки VR игры для UE4
Опыт разработки VR игры для UE4Опыт разработки VR игры для UE4
Опыт разработки VR игры для UE4
 
Организация работы с UE4 в команде до 20 человек
Организация работы с UE4 в команде до 20 человек Организация работы с UE4 в команде до 20 человек
Организация работы с UE4 в команде до 20 человек
 
Gameplay Tags
Gameplay TagsGameplay Tags
Gameplay Tags
 
Data Driven Gameplay in UE4
Data Driven Gameplay in UE4Data Driven Gameplay in UE4
Data Driven Gameplay in UE4
 
Code and Memory Optimisation Tricks
Code and Memory Optimisation Tricks Code and Memory Optimisation Tricks
Code and Memory Optimisation Tricks
 
The theory of relational databases
The theory of relational databasesThe theory of relational databases
The theory of relational databases
 
Automated layout testing using Galen Framework
Automated layout testing using Galen FrameworkAutomated layout testing using Galen Framework
Automated layout testing using Galen Framework
 
Sperasoft talks: Android Security Threats
Sperasoft talks: Android Security ThreatsSperasoft talks: Android Security Threats
Sperasoft talks: Android Security Threats
 
Sperasoft Talks: RxJava Functional Reactive Programming on Android
Sperasoft Talks: RxJava Functional Reactive Programming on AndroidSperasoft Talks: RxJava Functional Reactive Programming on Android
Sperasoft Talks: RxJava Functional Reactive Programming on Android
 
Sperasoft‬ talks j point 2015
Sperasoft‬ talks j point 2015Sperasoft‬ talks j point 2015
Sperasoft‬ talks j point 2015
 
Effective Мeetings
Effective МeetingsEffective Мeetings
Effective Мeetings
 
Unreal Engine 4 Introduction
Unreal Engine 4 IntroductionUnreal Engine 4 Introduction
Unreal Engine 4 Introduction
 
JIRA Development
JIRA DevelopmentJIRA Development
JIRA Development
 
Introduction to Elasticsearch
Introduction to ElasticsearchIntroduction to Elasticsearch
Introduction to Elasticsearch
 
MOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JSMOBILE DEVELOPMENT with HTML, CSS and JS
MOBILE DEVELOPMENT with HTML, CSS and JS
 
Quick Intro Into Kanban
Quick Intro Into KanbanQuick Intro Into Kanban
Quick Intro Into Kanban
 
ECMAScript 6 Review
ECMAScript 6 ReviewECMAScript 6 Review
ECMAScript 6 Review
 
Console Development in 15 minutes
Console Development in 15 minutesConsole Development in 15 minutes
Console Development in 15 minutes
 

Recently uploaded

"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan..."Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
Fwdays
 
FIDO Munich Seminar: Securing Smart Car.pptx
FIDO Munich Seminar: Securing Smart Car.pptxFIDO Munich Seminar: Securing Smart Car.pptx
FIDO Munich Seminar: Securing Smart Car.pptx
FIDO Alliance
 
Top 12 AI Technology Trends For 2024.pdf
Top 12 AI Technology Trends For 2024.pdfTop 12 AI Technology Trends For 2024.pdf
Top 12 AI Technology Trends For 2024.pdf
Marrie Morris
 
Keynote : Presentation on SASE Technology
Keynote : Presentation on SASE TechnologyKeynote : Presentation on SASE Technology
Keynote : Presentation on SASE Technology
Priyanka Aash
 
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptxFIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Alliance
 
Redefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI CapabilitiesRedefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI Capabilities
Priyanka Aash
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
AmandaCheung15
 
Self-Healing Test Automation Framework - Healenium
Self-Healing Test Automation Framework - HealeniumSelf-Healing Test Automation Framework - Healenium
Self-Healing Test Automation Framework - Healenium
Knoldus Inc.
 
Demystifying Neural Networks And Building Cybersecurity Applications
Demystifying Neural Networks And Building Cybersecurity ApplicationsDemystifying Neural Networks And Building Cybersecurity Applications
Demystifying Neural Networks And Building Cybersecurity Applications
Priyanka Aash
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
DianaGray10
 
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Snarky Security
 
Finetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and DefendingFinetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and Defending
Priyanka Aash
 
Enterprise_Mobile_Security_Forum_2013.pdf
Enterprise_Mobile_Security_Forum_2013.pdfEnterprise_Mobile_Security_Forum_2013.pdf
Enterprise_Mobile_Security_Forum_2013.pdf
Yury Chemerkin
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
Zilliz
 
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
Fwdays
 
Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...
Nohoax Kanont
 
History and Introduction for Generative AI ( GenAI )
History and Introduction for Generative AI ( GenAI )History and Introduction for Generative AI ( GenAI )
History and Introduction for Generative AI ( GenAI )
Badri_Bady
 
NVIDIA at Breakthrough Discuss for Space Exploration
NVIDIA at Breakthrough Discuss for Space ExplorationNVIDIA at Breakthrough Discuss for Space Exploration
NVIDIA at Breakthrough Discuss for Space Exploration
Alison B. Lowndes
 
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptxFIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Alliance
 
Exchange, Entra ID, Conectores, RAML: Todo, a la vez, en todas partes
Exchange, Entra ID, Conectores, RAML: Todo, a la vez, en todas partesExchange, Entra ID, Conectores, RAML: Todo, a la vez, en todas partes
Exchange, Entra ID, Conectores, RAML: Todo, a la vez, en todas partes
jorgelebrato
 

Recently uploaded (20)

"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan..."Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
"Building Future-Ready Apps with .NET 8 and Azure Serverless Ecosystem", Stan...
 
FIDO Munich Seminar: Securing Smart Car.pptx
FIDO Munich Seminar: Securing Smart Car.pptxFIDO Munich Seminar: Securing Smart Car.pptx
FIDO Munich Seminar: Securing Smart Car.pptx
 
Top 12 AI Technology Trends For 2024.pdf
Top 12 AI Technology Trends For 2024.pdfTop 12 AI Technology Trends For 2024.pdf
Top 12 AI Technology Trends For 2024.pdf
 
Keynote : Presentation on SASE Technology
Keynote : Presentation on SASE TechnologyKeynote : Presentation on SASE Technology
Keynote : Presentation on SASE Technology
 
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptxFIDO Munich Seminar In-Vehicle Payment Trends.pptx
FIDO Munich Seminar In-Vehicle Payment Trends.pptx
 
Redefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI CapabilitiesRedefining Cybersecurity with AI Capabilities
Redefining Cybersecurity with AI Capabilities
 
Zaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdfZaitechno Handheld Raman Spectrometer.pdf
Zaitechno Handheld Raman Spectrometer.pdf
 
Self-Healing Test Automation Framework - Healenium
Self-Healing Test Automation Framework - HealeniumSelf-Healing Test Automation Framework - Healenium
Self-Healing Test Automation Framework - Healenium
 
Demystifying Neural Networks And Building Cybersecurity Applications
Demystifying Neural Networks And Building Cybersecurity ApplicationsDemystifying Neural Networks And Building Cybersecurity Applications
Demystifying Neural Networks And Building Cybersecurity Applications
 
How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...How UiPath Discovery Suite supports identification of Agentic Process Automat...
How UiPath Discovery Suite supports identification of Agentic Process Automat...
 
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
Welcome to Cyberbiosecurity. Because regular cybersecurity wasn't complicated...
 
Finetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and DefendingFinetuning GenAI For Hacking and Defending
Finetuning GenAI For Hacking and Defending
 
Enterprise_Mobile_Security_Forum_2013.pdf
Enterprise_Mobile_Security_Forum_2013.pdfEnterprise_Mobile_Security_Forum_2013.pdf
Enterprise_Mobile_Security_Forum_2013.pdf
 
It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...It's your unstructured data: How to get your GenAI app to production (and spe...
It's your unstructured data: How to get your GenAI app to production (and spe...
 
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
"Hands-on development experience using wasm Blazor", Furdak Vladyslav.pptx
 
Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...Generative AI technology is a fascinating field that focuses on creating comp...
Generative AI technology is a fascinating field that focuses on creating comp...
 
History and Introduction for Generative AI ( GenAI )
History and Introduction for Generative AI ( GenAI )History and Introduction for Generative AI ( GenAI )
History and Introduction for Generative AI ( GenAI )
 
NVIDIA at Breakthrough Discuss for Space Exploration
NVIDIA at Breakthrough Discuss for Space ExplorationNVIDIA at Breakthrough Discuss for Space Exploration
NVIDIA at Breakthrough Discuss for Space Exploration
 
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptxFIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
FIDO Munich Seminar Blueprint for In-Vehicle Payment Standard.pptx
 
Exchange, Entra ID, Conectores, RAML: Todo, a la vez, en todas partes
Exchange, Entra ID, Conectores, RAML: Todo, a la vez, en todas partesExchange, Entra ID, Conectores, RAML: Todo, a la vez, en todas partes
Exchange, Entra ID, Conectores, RAML: Todo, a la vez, en todas partes
 

Rest services caching

  • 2. “A distributed system is one in which the failure of a computer you didn’t even know existed can render your own computer unusable.” - Leslie Lamport
  • 3. • REST stands for REpresentational State Transfer • Representation is just a very simple rendering of the object • Has benefits when leverages existing HTTP protocol What is REST?
  • 4. • Up-to-date • Fresh • Stale States of Resource Representation
  • 5. Up-to-Date state means the Representation is current according to the origin server Representation is being sent back with no expiry and no caching instructions means the client is allowed to cache for however long or not cache at all Up-to-Date State
  • 6. Fresh State considered as long as the Representation hasn’t expired at client side, proxy or browser Fresh State
  • 7. • Sending must-revalidate means the client must revalidate once the representation is Stale • Stale means it’s gone over it’s expiration date Stale State
  • 8. • Doesn’t actually mean do not cache • Means the client must revalidate both Fresh and Stale entries and then may use the cached copy if it’s up to date No-cache Directive
  • 9. • In plain English text format • Starting line: Method URI HTTP/version • Headers • Body HTTP Message
  • 10. Request: GET /wiki HTTP/1.1 Host: wikipedia.org Accept: text/html Connection: close Response: HTTP/1.1 200 OK Content-Type: text/html; charset=utf-8 Content-Language: en Content-Length: 1234 Sample HTTP Request/Response
  • 11. • Get • Post • Put • Delete • Options • Head • Patch • Trace • Link • Unlink • Connect Cache-enabled methods are in Red HTTP Methods
  • 12. Response: HTTP/1.1 200 OK Content-Type: text/html Content-Length: 1234 Expires: Fri, 27 Jan 2012 02:33:12 GMT •Allows only HTTP date •Good for static resources •Limited control HTTP Expires header
  • 13. • Enough for static content • For things that rarely change • Or don’t change at all like Calculator /Calculator/Multiply?x=2&y=2/Calculator/Multiply?x=2&y=2 ClientClient Expires is Enough?
  • 14. • public • private • no-cache • no-store • max-age=[seconds] • s-maxage=[seconds] • must-revalidate • proxy-revalidate • no-transform HTTP Cache-Control directives
  • 15. Response: HTTP/1.1 200 OK Content-Type: text/html Content-Length: 1234 Cache-Control: max-age=3600, must-revalidate HTTP Cache-Control Sample
  • 16. What if we need to update data? Cache-Control is Enough for REST
  • 17. • Optimistic is when we version our data • And do not have any transactions • Make use of ETag, If-Match and If-None- Match headers Optimistic Locking: ETag
  • 18. /Orders/Orders ClientClient GET /Orders HTTP/1.1 HTTP/1.1 200 OK Etag: 1 [content goes in body] GET /Orders HTTP/1.1 If-None-Match: 1 HTTP/1.1 304 Not Modified [no ETag] [no content returned!] ETag: GET Not Modified Resource
  • 19. /Orders/Orders ClientClient GET /Orders HTTP/1.1 HTTP/1.1 200 OK Etag: 1 [content goes in body] GET /Orders HTTP/1.1 If-None-Match: 1 HTTP/1.1 200 OK Etag: 2 [new content goes in body!] ETag: GET modified resource
  • 20. /Orders/Orders ClientClient HTTP/1.1 200 OK Etag: 1 [content goes in body] PUT /Orders HTTP/1.1 If-Match: 1 [new content goes in body] HTTP/1.1 100 Continue [no ETag] [no content!] GET /Orders HTTP/1.1 ETag: Modify Resource (PUT)
  • 21. /Orders/Orders ClientClient HTTP/1.1 200 OK Etag: 1 [content goes in body] PUT /Orders HTTP/1.1 If-Match: 1 [new content goes in body] HTTP/1.1 412 Precondition Failed [no ETag] [no content!] GET /Orders HTTP/1.1 ETag: Modify Changed Resource (PUT)
  • 22. God damned HTTP! What we gonna do? • Override changes! • Yeah! It’s possible! • Download the latest version using GET method • We will know the new Etag then Etag: mismatch when PUT
  • 23. /Orders/Orders ClientClient HTTP/1.1 412 Precondition Failed [no ETag] [no content!] PUT /Orders HTTP/1.1 If-None-Match: 1 [new content goes in body] HTTP/1.1 100 Continue [no ETag] [no content!] PUT /Orders HTTP/1.1 If-Match: 1 [new content goes in body] Etag: Override Changes When PUT
  • 24. • ETag and If-* headers came with HTTP 1.1 • In HTTP 1.0 there are another set of headers: Last-Modified: Sat, 29 Oct 2011 19:43:31 GMT If-Modified-Since: Sat, 29 Oct 2011 19:43:31 GMT Additional HTTP Headers
  • 25. int Multiply(int x, int y)int Multiply(int x, int y) HTTPHTTP IPC (Named Pipes)IPC (Named Pipes) TCPTCP ClientClient TCPTCP SOAPSOAP UDPUDP Web Services: Protocols
  • 26. POST /search HTTP/1.1 Host: www.domain.com Content-Type: application/x-www-form- urlencoded term=something HTTP/1.1 303 See Other Location: /search/something/1 POST-Redirect-GET pattern