MCPcopy Create free account
hub / github.com/adonisjs/session / increment

Method increment

src/session.ts:367–369  ·  view source on GitHub ↗

* Increments the value of a key inside the session store. * A new key will be defined if it doesn't exist already with value 1. * * @param key - The key to increment * @param steps - Number of steps to increment (default: 1) * * @example * session.increment('page_views') //

(key: string, steps: number = 1)

Source from the content-addressed store, hash-verified

365 * session.increment('score', 10) // Increments by 10
366 */
367 increment(key: string, steps: number = 1) {
368 return this.#getValuesStore('write').increment(key, steps)
369 }
370
371 /**
372 * Decrements the value of a key inside the session store.

Callers 2

session.spec.tsFile · 0.45

Calls 1

#getValuesStoreMethod · 0.95

Tested by

no test coverage detected