Search code examples
javamysqlspringcachingin-memory-cache

Implement own in memory cache mechanism in spring boot


I was asked to implement an in memory cache mechanism in my spring boot application. My application is related to social media. User can register and login User can add friend User can post status with privacy criteria public and private User can view public post and private post of their friend post only User can see the post which has more number of likes and they have access to.

How can I implement my own cache mechanism? I should design my own data structure to store cache.

Which api end points can I have cache features?

I'm new to spring.

Thanks in advance


Solution

  • I done it by creating concurrent hashmap and stored value in runtime and also made that hashmap object Threadsafe. which means only one thread can edit the value of hashmap