I am a mobile developer and have started using Google Place API for an autocomplete suggestion to find places in my app. But I have observed that Google Places API becomes costly when scaling. So i have made some optimization on the mobile side as follows:-
- Limit autocomplete for at least 3 character
- The threshold value to make API call for autocomplete is the 500millisecond difference between 2 characters typed
- Do a local caching of results with LRU mechanism
With all this optimization client side is good. But now I am also thinking to optimize from backend API side also. For this optimization, I will create a wrapper for google places auto-complete api with server-side caching. This caching will have a time-span of 30days as per Google Guidelines.
I need help to understand how can i design this? Like what key and value combination i need to store autocomplete suggestion? Should I use Redis or Hazelcast? I am writing my Backend in Java with aws server using micro-service architecture. Any already implemented solution where I can look into and learn.
Please help as I am a newbie Backend developer.