Announcements
The Google Cloud Community will be in read-only from July 16 - July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Can you put a write lock on a cache entry?

Is there a way to stop another request thread updating a cache entry whilst you are using it.

Scenario is that we want to limit the number of failed login attempts by an end user and lock the account once the limit has been exceeded. We were planning on storing the failed attempts in the cache but that seems unsafe as a large number of failed requests for a single user in a short period of time could result in read, read, read, write, write, write scenario as opposed to the desired read, write, read, write, read write. That would mean that you could easily exceed the allowed number of requests before locking kicked in.

0 2 226
2 REPLIES 2