# APC User Cache

# Introduction

APCu is an in-memory key-value store for PHP. Keys are of type string and values can be any PHP variables. APCu only supports userland caching of variables.

The APCu cache is per-process on Windows, so when using a process-based (rather than thread-based) SAPI, it will not be shared between different processes.

APCu is APC stripped of opcode caching.

The first APCu codebase was versioned 4.0.0, it was forked from the head of the APC master branch at the time. PHP 7 support is available as of APCu 5.0.0. PHP 8 support is available as of APCu 5.1.19.

- Installing/Configuring
  - Installation
  - Runtime Configuration
- Predefined Constants
- APCu Functions
  - apcu_add — Cache a new variable in the data store
  - apcu_cache_info — Retrieves cached information from APCu's data store
  - apcu_cas — Updates an old value with a new value
  - apcu_clear_cache — Clears the APCu cache
  - apcu_dec — Decrease a stored number
  - apcu_delete — Removes a stored variable from the cache
  - apcu_enabled — Whether APCu is usable in the current environment
  - apcu_entry — Atomically fetch or generate a cache entry
  - apcu_exists — Checks if entry exists
  - apcu_fetch — Fetch a stored variable from the cache
  - apcu_inc — Increase a stored number
  - apcu_key_info — Get detailed information about the cache key
  - apcu_sma_info — Retrieves APCu Shared Memory Allocation information
  - apcu_store — Cache a variable in the data store
- APCUIterator — The APCUIterator class
  - APCUIterator::__construct — Constructs an APCUIterator iterator object
  - APCUIterator::current — Get current item
  - APCUIterator::getTotalCount — Get total count
  - APCUIterator::getTotalHits — Get total cache hits
  - APCUIterator::getTotalSize — Get total cache size
  - APCUIterator::key — Get iterator key
  - APCUIterator::next — Move pointer to next item
  - APCUIterator::rewind — Rewinds iterator
  - APCUIterator::valid — Checks if current position is valid

`↑` and `↓` to navigate • `Enter` to select • `Esc` to close • `/` to open