@@ -147,7 +147,7 @@ case class CacheServiceRedisImpl(pool: JedisPool) extends CacheService {
147147 * @param key the key.
148148 * @param value the value.
149149 */
150- def putStringValue (key : String , value : String ): Task [Unit ] = Task .attempt {
150+ def putStringValue (key : String , value : String ): Task [Unit ] = ZIO .attempt {
151151
152152 if (key.isEmpty)
153153 throw EmptyKey (" The key under which the value should be written is empty. Aborting writing to redis." )
@@ -176,18 +176,18 @@ case class CacheServiceRedisImpl(pool: JedisPool) extends CacheService {
176176 conn <- ZIO .attempt(pool.getResource)
177177 value <- ZIO .attemptBlocking(conn.get(key))
178178 res <-
179- if (value == " nil" .getBytes) Task .succeed(None )
180- else Task .succeed(Some (value))
179+ if (value == " nil" .getBytes) ZIO .succeed(None )
180+ else ZIO .succeed(Some (value))
181181 _ = conn.close()
182182 } yield res
183- }.catchAll(ex => ZIO .logError(s " Reading string from Redis failed: ${ex.getMessage}" ) *> Task .succeed(None ))
183+ }.catchAll(ex => ZIO .logError(s " Reading string from Redis failed: ${ex.getMessage}" ) *> ZIO .succeed(None ))
184184
185185 /**
186186 * Removes values for the provided keys. Any invalid keys are ignored.
187187 *
188188 * @param keys the keys.
189189 */
190- def removeValues (keys : Set [String ]): Task [Unit ] = Task .attemptBlocking {
190+ def removeValues (keys : Set [String ]): Task [Unit ] = ZIO .attemptBlocking {
191191
192192 // del takes a vararg so I nee to convert the set to a swq and then to vararg
193193 val conn : Jedis = pool.getResource
@@ -206,7 +206,7 @@ case class CacheServiceRedisImpl(pool: JedisPool) extends CacheService {
206206 * @param key the key.
207207 * @param value the value.
208208 */
209- private def putBytesValue (key : String , value : Array [Byte ]): Task [Unit ] = Task .attemptBlocking {
209+ private def putBytesValue (key : String , value : Array [Byte ]): Task [Unit ] = ZIO .attemptBlocking {
210210
211211 if (key.isEmpty)
212212 throw EmptyKey (" The key under which the value should be written is empty. Aborting writing to redis." )
@@ -236,15 +236,15 @@ case class CacheServiceRedisImpl(pool: JedisPool) extends CacheService {
236236 conn <- ZIO .attempt(pool.getResource).onError(ZIO .logErrorCause(_)).orDie
237237 value <- ZIO .attemptBlocking(conn.get(key.getBytes))
238238 res <-
239- if (value == " nil" .getBytes) Task .succeed(None )
240- else Task .succeed(Some (value))
239+ if (value == " nil" .getBytes) ZIO .succeed(None )
240+ else ZIO .succeed(Some (value))
241241 _ = conn.close()
242242 } yield res
243243
244244 /**
245245 * Flushes (removes) all stored content from the Redis store.
246246 */
247- def flushDB (requestingUser : UserADM ): Task [Unit ] = Task .attemptBlocking {
247+ def flushDB (requestingUser : UserADM ): Task [Unit ] = ZIO .attemptBlocking {
248248
249249 if (! requestingUser.isSystemUser) {
250250 throw ForbiddenException (" Only the system user is allowed to perform this operation." )
@@ -265,7 +265,7 @@ case class CacheServiceRedisImpl(pool: JedisPool) extends CacheService {
265265 /**
266266 * Pings the Redis store to see if it is available.
267267 */
268- def ping (): Task [CacheServiceStatusResponse ] = Task .attemptBlocking {
268+ def ping (): Task [CacheServiceStatusResponse ] = ZIO .attemptBlocking {
269269
270270 val conn : Jedis = pool.getResource
271271 try {
@@ -274,7 +274,7 @@ case class CacheServiceRedisImpl(pool: JedisPool) extends CacheService {
274274 } finally {
275275 conn.close()
276276 }
277- }.catchAll(ex => ZIO .logError(s " Ping failed: ${ex.getMessage}" ) *> Task .succeed(CacheServiceStatusNOK ))
277+ }.catchAll(ex => ZIO .logError(s " Ping failed: ${ex.getMessage}" ) *> ZIO .succeed(CacheServiceStatusNOK ))
278278}
279279
280280object CacheServiceRedisImpl {
0 commit comments