-
Notifications
You must be signed in to change notification settings - Fork 6
/
cache.php
34 lines (28 loc) · 892 Bytes
/
cache.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
use Spray\Serializer\AnnotationBackedPropertyInfo;
use Spray\Serializer\Cache\FileCache;
use Spray\Serializer\Object\ObjectSerializerGenerator;
use Spray\Serializer\Object\SerializerLocator;
use Spray\Serializer\Object\SerializerRegistry;
use Spray\Serializer\ObjectListener;
use Spray\Serializer\Serializer;
use Symfony\Component\Filesystem\Filesystem;
chdir(dirname(__DIR__));
require 'vendor/autoload.php';
$serializer = new Serializer();
$serializer->attach(
new ObjectListener(
new SerializerLocator(
new SerializerRegistry(),
new ObjectSerializerGenerator(
new AnnotationBackedPropertyInfo()
),
new FileCache(new Filesystem(), __DIR__, 'Serializer')
)
)
);
var_export($serializer->serialize(new CacheMe()));
echo file_get_contents(__DIR__ . '/CacheMeSerializer.php');
class CacheMe
{
}