Skip to content

Commit 4f50872

Browse files
committed
minor #7627 Update doc. Remove class ApcCache from doc (alexpts, javiereguiluz)
This PR was merged into the 3.2 branch. Discussion ---------- Update doc. Remove class `ApcCache` from doc Class `ApcCache` was deprecated since 2.5 and removed from 3.0 version. Update doc. Commits ------- 7d4a554 Minor reword 9b9bb7c Update doc. Remove class `ApcCache` from doc
2 parents 6383f59 + 7d4a554 commit 4f50872

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

components/validator/resources.rst

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,18 @@ Caching
148148
Using many loaders to load metadata from different places is convenient, but it
149149
can slow down your application because each file needs to be parsed, validated
150150
and converted into a :class:`Symfony\\Component\\Validator\\Mapping\\ClassMetadata`
151-
instance. To solve this problem, you can cache the ``ClassMetadata`` information.
151+
instance.
152152

153-
The Validator component comes with an
154-
:class:`Symfony\\Component\\Validator\\Mapping\\Cache\\ApcCache`
155-
implementation. You can easily create other cachers by creating a class which
156-
implements :class:`Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface`.
153+
To solve this problem, call the :method:`Symfony\\Component\\Validator\\ValidatorBuilder::setMetadataCache`
154+
method of the Validator builder and pass your own caching class (which must
155+
implement :class:`Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface`)::
156+
157+
use Symfony\Component\Validator\Validation;
158+
159+
$validator = Validation::createValidatorBuilder()
160+
// ... add loaders
161+
->setMetadataCache(new SomeImplementCacheInterface());
162+
->getValidator();
157163

158164
.. note::
159165

@@ -163,18 +169,6 @@ implements :class:`Symfony\\Component\\Validator\\Mapping\\Cache\\CacheInterface
163169
the Validator still needs to merge all metadata of one class from every
164170
loader when it is requested.
165171

166-
Enable the cache calling the
167-
:method:`Symfony\\Component\\Validator\\ValidatorBuilder::setMetadataCache`
168-
method of the Validator builder::
169-
170-
use Symfony\Component\Validator\Validation;
171-
use Symfony\Component\Validator\Mapping\Cache\ApcCache;
172-
173-
$validator = Validation::createValidatorBuilder()
174-
// ... add loaders
175-
->setMetadataCache(new ApcCache('some_apc_prefix'));
176-
->getValidator();
177-
178172
Using a Custom MetadataFactory
179173
------------------------------
180174

0 commit comments

Comments
 (0)