Skip to content

Commit

Permalink
feat: make functions suspend if we want to use some effect
Browse files Browse the repository at this point in the history
  • Loading branch information
realdavidvega committed Sep 30, 2024
1 parent 1258b99 commit 535b818
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ abstract class CachedTool<Input, Output>(
*
* @return true if the cache should be used.
*/
open fun shouldUseCache(input: Input): Boolean = true
open suspend fun shouldUseCache(input: Input): Boolean = true

/**
* Criteria to check if the result should be cached based on the given [input] and [output]. By
* default, it returns true, meaning always cache the result.
*
* @return true if the result should be cached.
*/
open fun shouldCacheOutput(input: Input, output: Output): Boolean = true
open suspend fun shouldCacheOutput(input: Input, output: Output): Boolean = true

/**
* Caches the result of [onCacheMissed] if [shouldCacheOutput] returns true. Otherwise, returns
Expand Down

0 comments on commit 535b818

Please sign in to comment.