<?php

namespace Acms\Services\Cache;

use Acms\Contracts\ServiceProvider;
use Acms\Services\Container;

class CacheServiceProvider extends ServiceProvider
{
    /**
     * register service
     *
     * @param \Acms\Services\Container $container
     *
     * @return void
     */
    public function register(Container $container)
    {
        $container->singleton('cache', 'Acms\Services\Cache\CacheManager');
        $container->singleton('cache.page-writer', function () use ($container) {
            /** @var \Acms\Services\Cache\CacheManager $cacheManager */
            $cacheManager = $container->make('cache');
            return new PageCacheWriter($cacheManager->page());
        });
    }

    /**
     * initialize service
     *
     * @return void
     */
    public function init()
    {
    }
}
