CakePHP
  • Documentation
    • Book
    • API
    • Videos
    • Reporting Security Issues
    • Privacy Policy
    • Logos & Trademarks
  • Business Solutions
  • Swag
  • Road Trip
  • Team
  • Community
    • Community
    • Get Involved
    • Issues (Github)
    • Bakery
    • Featured Resources
    • Training
    • Meetups
    • My CakePHP
    • CakeFest
    • Newsletter
    • Linkedin
    • YouTube
    • Facebook
    • Twitter
    • Mastodon
    • Help & Support
    • Forum
    • Stack Overflow
    • IRC
    • Slack
    • Paid Support
CakePHP

C CakePHP 6.0 API

  • Project:
    • CakePHP
      • CakePHP
      • Authentication
      • Authorization
      • Chronos
      • Elastic Search
      • Queue
  • Version:
    • 6.0
      • 6.0
      • 5.4
      • 5.3
      • 5.2
      • 5.1
      • 5.0
      • 4.6
      • 4.5
      • 4.4
      • 4.3
      • 4.2
      • 4.1
      • 4.0
      • 3.10
      • 3.9
      • 3.8
      • 3.7
      • 3.6
      • 3.5
      • 3.4
      • 3.3
      • 3.2
      • 3.1
      • 3.0
      • 2.10
      • 2.9
      • 2.8
      • 2.7
      • 2.6
      • 2.5
      • 2.4
      • 2.3
      • 2.2
      • 2.1
      • 2.0
      • 1.3
      • 1.2

Namespaces

  • Global
  • Cake
    • AttributeResolver
    • Cache
    • Collection
    • Command
    • Console
    • Container
    • Controller
    • Core
    • Database
    • Datasource
    • Error
    • Event
    • Form
    • Http
    • I18n
    • Lock
    • Log
    • Mailer
    • Network
    • ORM
    • Routing
    • TestSuite
    • Utility
    • Validation
    • View

Namespace Engine

Classes

  • FileLockEngine

    File-based lock engine using flock().

    This engine uses PHP's flock() function for locking, which provides advisory locking on the filesystem. This is suitable for single-server deployments but NOT for distributed systems.

    Note: This engine does not support TTL-based automatic expiration. Locks are held until explicitly released, the acquired lock is destroyed, or the process terminates. A cleanup mechanism is provided for stale lock files.

    Configuration options:

    • path: Directory path for lock files (default: system temp directory)
    • prefix: Prefix for lock file names (default: 'lock_')
    • ttl: Default TTL for stale file cleanup (default: 300)
  • MemcachedLockEngine

    Memcached-based lock engine.

    Uses Memcached's add() operation for atomic lock acquisition. Note: Memcached does not support Lua scripting, so some operations are less atomic than the Redis implementation.

    Configuration options:

    • servers: Array of server configurations (default: [['127.0.0.1', 11211]])
    • prefix: Prefix for lock keys (default: 'lock_')
    • ttl: Default lock TTL in seconds (default: 300)
    • persistent: Persistent connection ID (default: false)
  • NullLockEngine

    Null lock engine that always succeeds.

    This engine is useful for:

    • Testing without actual locking
    • Development environments where locking isn't needed
    • Fallback when the primary lock engine fails

    WARNING: This engine provides NO actual locking. Do not use in production where concurrent access protection is required.

  • RedisLockEngine

    Redis-based lock engine.

    Uses Redis SET with NX and EX options for atomic lock acquisition. This provides a reliable distributed locking mechanism.

    Supports both a single Redis node (or primary behind a proxy) and Redis Cluster via phpredis' RedisCluster client. Cluster mode is enabled by providing nodes (and optionally clusterName).

    Configuration options:

    • host: Redis server hostname (default: '127.0.0.1'). Non-cluster only.
    • port: Redis server port (default: 6379). Non-cluster only.
    • password: Redis server password (default: false).
    • database: Redis database index (default: 0). Non-cluster only.
    • timeout: Connection timeout in seconds (default: 0).
    • readTimeout: Read timeout in seconds (default: 0). Cluster only.
    • persistent: Use persistent connections (default: true).
    • prefix: Prefix for lock keys (default: 'lock_').
    • ttl: Default lock TTL in seconds (default: 300).
    • nodes: List of <ip>:<port> seed nodes for Redis Cluster. Presence of this option (or clusterName) switches the engine to cluster mode.
    • clusterName: Named cluster entry configured via redis.clusters.seeds.
    • failover: Cluster failover mode (distribute, distribute_slaves, error, none). Cluster only.
    • tls: When true, enables TLS for cluster connections. Cluster only.
OpenHub
Pingping
Linode
  • Business Solutions
  • Showcase
  • Documentation
  • Book
  • API
  • Videos
  • Reporting Security Issues
  • Privacy Policy
  • Logos & Trademarks
  • Community
  • Get Involved
  • Issues (Github)
  • Bakery
  • Featured Resources
  • Training
  • Meetups
  • My CakePHP
  • CakeFest
  • Newsletter
  • Linkedin
  • YouTube
  • Facebook
  • Twitter
  • Mastodon
  • Help & Support
  • Forum
  • Stack Overflow
  • IRC
  • Slack
  • Paid Support

Generated using CakePHP API Docs