Skip to content

Commit b4865e9

Browse files
committed
add comments about keys
1 parent 127b68f commit b4865e9

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Validator/ValidationCache.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
* This can improve performance by skipping validation for known-good query, schema, and rules combinations.
1414
* You are responsible for defining how cache keys are computed.
1515
*
16+
* Some things to keep in mind when generating keys:
17+
* - PHP's `serialize` method is fast, but can't handle certain structures such as closures.
18+
* - If your `schema` does include closures or is quite large and complex, consider
19+
* using some kind of build-time version number or other environment variable.
20+
* - Keep in mind that there are internal `rules` that are applied in addition to any you pass in,
21+
* and it's possible these may shift or expand as the library evolves, so it might make sense
22+
* to include the library version number in your keys.
23+
*
1624
* @see PsrValidationCacheAdapter for a toy implementation.
1725
*/
1826
interface ValidationCache

0 commit comments

Comments
 (0)