Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Flow\Data; |
| 4 | |
| 5 | /** |
| 6 | * Indexes store one or more values bucketed by exact key/value combinations. |
| 7 | */ |
| 8 | interface Index extends LifecycleHandler { |
| 9 | /** |
| 10 | * Find data models matching the provided equality condition. |
| 11 | * |
| 12 | * @param array $keys A map of k,v pairs to find via equality condition |
| 13 | * @param array $options Options to use |
| 14 | * @return array Cached subset of data model rows matching the |
| 15 | * equality conditions provided in $keys. |
| 16 | */ |
| 17 | public function find( array $keys, array $options = [] ); |
| 18 | |
| 19 | /** |
| 20 | * Batch together multiple calls to self::find with minimal network round trips. |
| 21 | * |
| 22 | * @param array $queries An array of arrays in the form of $keys parameter of self::find |
| 23 | * @param array $options Options to use |
| 24 | * @return array[] Array of arrays in same order as $queries representing batched result set. |
| 25 | */ |
| 26 | public function findMulti( array $queries, array $options = [] ); |
| 27 | |
| 28 | /** |
| 29 | * Returns a boolean true/false if the find()-operation for the given |
| 30 | * attributes has already been resolves and doesn't need to query any |
| 31 | * outside cache/database. |
| 32 | * Determining if a find() has not yet been resolved may be useful so that |
| 33 | * additional data may be loaded at once. |
| 34 | * |
| 35 | * @param array $attributes Attributes to find() |
| 36 | * @param array $options Options to find() |
| 37 | * @return bool |
| 38 | */ |
| 39 | public function found( array $attributes, array $options = [] ); |
| 40 | |
| 41 | /** |
| 42 | * Returns a boolean true/false if the findMulti()-operation for the given |
| 43 | * attributes has already been resolves and doesn't need to query any |
| 44 | * outside cache/database. |
| 45 | * Determining if a find() has not yet been resolved may be useful so that |
| 46 | * additional data may be loaded at once. |
| 47 | * |
| 48 | * @param array $attributes Attributes to find() |
| 49 | * @param array $options Options to find() |
| 50 | * @return bool |
| 51 | */ |
| 52 | public function foundMulti( array $attributes, array $options = [] ); |
| 53 | |
| 54 | /** |
| 55 | * @return int Maximum number of items in a single index value |
| 56 | */ |
| 57 | public function getLimit(); |
| 58 | |
| 59 | /** |
| 60 | * Rows are first sorted based on the first term of the result, then ties |
| 61 | * are broken by evaluating the second term and so on. |
| 62 | * |
| 63 | * @todo choose a default sort instead of false? |
| 64 | * @return array|false Columns to sort on |
| 65 | */ |
| 66 | public function getSort(); |
| 67 | |
| 68 | /** |
| 69 | * Query options are not supported at the query level, the index always |
| 70 | * returns the same value for the same key/value combination. Depending on what |
| 71 | * the query stores it may contain the answers to various options, which will require |
| 72 | * post-processing by the caller. |
| 73 | * |
| 74 | * @param array $keys |
| 75 | * @param array $options |
| 76 | * @return bool Can the index locate a result for this keys and options pair |
| 77 | */ |
| 78 | public function canAnswer( array $keys, array $options ); |
| 79 | |
| 80 | /** |
| 81 | * @param object $object |
| 82 | * @param array $row |
| 83 | */ |
| 84 | public function cachePurge( $object, array $row ); |
| 85 | } |