Some applications make heavy use of sessions to store user related data or other necessary information for correct operation, while others don't. Since Phalcon offers the DI container, where we can store various services, we can take advantage of it and store our session service there, ensuring that the session starts only when the application requires it to do so. Phalcon offers a simple yet powerful object oriented interface to work with sessions. In this recipe, we will discuss how to configure and use the session component with adapters such as Memcached and Redis.
To implement this recipe, we don't need a fully deployed or working application. We can demonstrate the functionality in a simple script. However, you will need to have the appropriate PHP extensions enabled, as well as access to a Memcached
and/or Redis
server. We will use telnet
and redis-cli
for testing, so these utilities need to be installed in your system. Any other alternative...