SchemaCache.interface.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. /**
  4. * File containing the Net_LDAP2_SchemaCache interface class.
  5. *
  6. * PHP version 5
  7. *
  8. * @category Net
  9. * @package Net_LDAP2
  10. * @author Benedikt Hallinger <beni@php.net>
  11. * @copyright 2009 Benedikt Hallinger
  12. * @license http://www.gnu.org/licenses/lgpl-3.0.txt LGPLv3
  13. * @version SVN: $Id: SchemaCache.interface.php 286718 2009-08-03 07:30:49Z beni $
  14. * @link http://pear.php.net/package/Net_LDAP2/
  15. */
  16. /**
  17. * Interface describing a custom schema cache object
  18. *
  19. * To implement a custom schema cache, one must implement this interface and
  20. * pass the instanciated object to Net_LDAP2s registerSchemaCache() method.
  21. */
  22. interface Net_LDAP2_SchemaCache
  23. {
  24. /**
  25. * Return the schema object from the cache
  26. *
  27. * Net_LDAP2 will consider anything returned invalid, except
  28. * a valid Net_LDAP2_Schema object.
  29. * In case you return a Net_LDAP2_Error, this error will be routed
  30. * to the return of the $ldap->schema() call.
  31. * If you return something else, Net_LDAP2 will
  32. * fetch a fresh Schema object from the LDAP server.
  33. *
  34. * You may want to implement a cache aging mechanism here too.
  35. *
  36. * @return Net_LDAP2_Schema|Net_LDAP2_Error|false
  37. */
  38. public function loadSchema();
  39. /**
  40. * Store a schema object in the cache
  41. *
  42. * This method will be called, if Net_LDAP2 has fetched a fresh
  43. * schema object from LDAP and wants to init or refresh the cache.
  44. *
  45. * In case of errors you may return a Net_LDAP2_Error which will
  46. * be routet to the client.
  47. * Note that doing this prevents, that the schema object fetched from LDAP
  48. * will be given back to the client, so only return errors if storing
  49. * of the cache is something crucial (e.g. for doing something else with it).
  50. * Normaly you dont want to give back errors in which case Net_LDAP2 needs to
  51. * fetch the schema once per script run and instead use the error
  52. * returned from loadSchema().
  53. *
  54. * @return true|Net_LDAP2_Error
  55. */
  56. public function storeSchema($schema);
  57. }