grrolland / ngx-distributed-shm

Distributed SHM storage based on Hazelcast for NGinx.
GNU General Public License v3.0
19 stars 6 forks source link

feat(#24): INCR with initial expiration #25

Closed alexist closed 11 months ago

alexist commented 11 months ago

Implementation of #24

The lua.shared semantic has evolved. The method incr now accept an optional parameter init_ttl :

syntax: newval, err, forcible? = ngx.shared.DICT:incr(key, value, init?, init_ttl?)

init_ttl allow to create the missing key with a ttl and avoid to make another call to handle expiration (incr than expire)

remaining, err = dict:incr(key, -1, limit, window)

A new parameter has been added to INCR command in order to be compliant with lua.shared.DICT