mirror of
https://github.com/OpenBankProject/OBP-API.git
synced 2026-02-06 13:26:51 +00:00
TODO in RateLimitingUtil.scala
This commit is contained in:
parent
b083fb7bb0
commit
f63197fe48
@ -151,6 +151,14 @@ object RateLimitingUtil extends MdcLoggable {
|
||||
(limit) match {
|
||||
case l if l > 0 => // Redis is available and limit is set
|
||||
val key = createUniqueKey(consumerKey, period)
|
||||
// TODO: Check if we can remove redundant EXISTS check. GET returns None when key does not exist.
|
||||
// Check This would reduce Redis operations from 2 to 1 (25% reduction per request).
|
||||
// Simplified code:
|
||||
// val currentValue = Redis.use(JedisMethod.GET, key)
|
||||
// currentValue match {
|
||||
// case Some(value) => value.toLong + 1 <= limit
|
||||
// case None => true // Key does not exist, first call
|
||||
// }
|
||||
val exists = Redis.use(JedisMethod.EXISTS,key).map(_.toBoolean).get
|
||||
exists match {
|
||||
case true =>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user