Test Failed
Push — master ( e7e248...cb9afd )
by Maximo
02:40 queued 40s
created

library/Providers/SessionProvider.php (1 issue)

1
<?php
0 ignored issues
show
End of line character is invalid; expected "\n" but found "\r\n"
Loading history...
2
3
namespace Gewaer\Providers;
4
5
use Phalcon\Di\ServiceProviderInterface;
6
use Phalcon\DiInterface;
7
8
class SessionProvider implements ServiceProviderInterface
9
{
10
    /**
11
     * @param DiInterface $container
12
     */
13
    public function register(DiInterface $container)
14
    {
15
        $container->setShared(
16
            'session',
17
            function () {
18
                $memcache = new \Phalcon\Session\Adapter\Memcache([
19
                    'host' => envValue('DATA_API_MEMCACHED_HOST', '127.0.0.1'),
20
                    'post' => envValue('DATA_API_MEMCACHED_PORT', 11211),
21
                    'lifetime' => 8600, // optional (standard: 8600)
22
                    'prefix' => 'baka-api', // optional (standard: [empty_string]), means memcache key is my-app_31231jkfsdfdsfds3
23
                    'persistent' => false, // optional (standard: false)
24
                ]);
25
26
                $memcache->start();
27
28
                return $memcache;
29
            }
30
        );
31
    }
32
}
33