CacheAutocomplete

@Target(allowedTargets = [AnnotationTarget.FUNCTION])
annotation class CacheAutocomplete(val cacheMode: AutocompleteCacheMode = AutocompleteCacheMode.CONSTANT_BY_KEY, val forceCache: Boolean = false, val cacheSize: Long = 2048, val compositeKeys: Array<String> = [], val guildLocal: Boolean = false, val userLocal: Boolean = false, val channelLocal: Boolean = false)(source)

Enables autocomplete caching.

By default, this will cache results by key, which is the input of the focused option.
However, you can use composite keys if you want to cache based off multiple option values, see compositeKeys for more details.

See also

@SlashOption

@AutocompleteHandler

Properties

Link copied to clipboard
Link copied to clipboard
val cacheSize: Long = 2048

Sets the cache size for this autocomplete cache, in kilobytes (KB).

Link copied to clipboard
val channelLocal: Boolean = false

Defines whether this autocomplete will give different results based on which Channel this interaction is executing on.

Link copied to clipboard

The set of option names (the one you see on Discord) which forms the cache key.

Link copied to clipboard
val forceCache: Boolean = false

Whether the cache should be used even if autocomplete cache is disabled.

Link copied to clipboard
val guildLocal: Boolean = false

Defines whether this autocomplete will give different results based on which Guild this interaction is executing on.

Link copied to clipboard
val userLocal: Boolean = false

Defines whether this autocomplete will give different results based on which User is executing this interaction.