Peter Claes
Peter Claes

Reputation: 335

kong cache invalidation throws error : key must be a string

In a custom plugin I need to invalidate a Kong cache entry. When I use

kong.cache.invalidate_local("thisisastring")

I get error

key must be a string
 stack traceback:
    [C]: in function 'error'
    /usr/local/share/lua/5.1/kong/cache/init.lua:226: in function 'invalidate_local'

I'm using Kong 2.7.0.

https://github.com/Kong/kong/blob/2.7.0/kong/cache/init.lua#L226

What is wrong?

Upvotes: 0

Views: 566

Answers (1)

Ôrel
Ôrel

Reputation: 7632

You should use : not .

      kong.cache:invalidate_local("your string")

More info about difference between : and .

Upvotes: 1

Related Questions