Spring Boot - Caching Data - Introduction | Part 1 | Simple Programming

preview_player
Показать описание
Welcome to Simple Programming

In this video, let us see how to use cache in an API project

there are different cache mechanisms available in the market for you to make use of, like ehcache redis, HazelCast, CouchBase, Gemfire, etc

In this example we will look into cache in two parts, in the first part we will look at the auto-configuration inbuilt cache functionality and in the next part we will see how to use cache manger to configure multiple caches and how to set expiry for them and for this i will use ehCache with java configurations,

before we jump into hands on lets discuss a common topic that many developers are confused about
What is the difference between Cache and a Cookie
Cookie - used to store user details
Cache - used to store information to render the page faster

Cookies often track information like how frequently the user visits, what are the times of visits, what banners have been clicked on, what button clicked, user preferences, items in shopping cart, etc
Example would be youtube, or facebook. They show ads based on the information available in your cookies.
you would have noticed that facebook would show ads related to shoes in their page how is that done.
well this is where cookie comes of use

Whereas in case of Cache
For example, when you open websites with large pictures and video’s or a page with huge data that takes some time to render in front of you, it might take some time to load the website.
Here we can use cache to stores the site contents like the images, videos, audio, huge data etc. on your computer. So the next time you load the same website you will find it loading faster

Both cookie and cache can have an expiry time limit, depending upon ur business needs

Caching Replacement Algorithms -

Ehcache Documentation Cache Size -

EhCache Eviction Algorithms Documentation -

Рекомендации по теме
Комментарии
Автор

Your videos are really of quality content... Please make more videos on java and spring boot...

prathameshtamte
Автор

Very easy to understand
Thank you very much keep update more videos on spring boot. 🖖

raghavendrabhandari
Автор

well explained. please make other videos

nicolahcm
Автор

Thanks for this video 🙏 it resolved my issue

vimmysingh
Автор

hello, thank you for your wonderful vid. Ill go look up the samples. Be well, Joel

joelboardgamerpger
Автор

A very precise demo on the subject matter. Kudos!
Could you pls let know how can I resolve the import at 3:23 APIConfig.java?

SumitKumar-kvpx
Автор

Thank you for this wonderful video. I have two queries.

1. In order to implement caching for all the methods, do i need to manually add @Cacheable annotation over all the methods or is there a way to enable caching for all methods globally.

2. My spring boot application is using jwt stateless authentication mechanism using spring security. As there are no sessions maintained, is there any benefit of using hibernate 2nd level caching in my scenario.

himanshupratap
Автор

this is not in-memory cache, right? Where are the configurations(ip, port etc) for cache server?

samiles
Автор

how it will get synchronised with other instances ?

ravisoni
Автор

why return responseentity and not just the object?

livb
Автор

how to write for generics request I don't know the request name but still I want to write all request coming..

ashutoshshukla
Автор

Query : what if some one modifies data in meanwhile and this cache will return wrong values

dilip
visit shbcf.ru