Guest User

Untitled

a guest
Jul 15th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. <?php
  2.  
  3. class Foo extends Nette\Object
  4. {
  5.  
  6. /**
  7. * @Cache(expire=3600)
  8. * @Tags(foo, fuuu)
  9. * @return array
  10. */
  11. public function foo()
  12. {
  13. echo("getting ");
  14.  
  15. return func_get_args();
  16. }
  17.  
  18. /**
  19. * @Cache(expire=3600)
  20. * @Tags(bar, fuuu)
  21. * @return array
  22. */
  23. public function bar()
  24. {
  25. echo("getting ");
  26.  
  27. return func_get_args();
  28. }
  29.  
  30.  
  31.  
  32. /**
  33. * @return Foo
  34. */
  35. public function __call($method, $args)
  36. {
  37. return Kdyby\Tools\ModelTools::tryCall($this, $method, $args);
  38. }
  39.  
  40.  
  41.  
  42. /**
  43. * @param array $conds
  44. */
  45. public static function cleanCache($conds)
  46. {
  47. Kdyby\Tools\ModelTools::cleanCache($conds);
  48. }
  49.  
  50. }
  51.  
  52. echo "<hr>";
  53. $f = new Foo();
  54. dump($f->foo(1), $f->foo(1));
  55.  
  56. echo "<hr>";
  57. dump($f->c_foo(1), $f->c_foo(1));
  58.  
  59. dump($f->c_bar('neco'), $f->c_bar('neco'));
  60. $f::cleanCache(array( 'tags' => array('bar') ));
  61. dump($f->c_bar('neco'), $f->c_bar('neco'));
  62.  
  63. dump($f->c_foo('test', array('test1', 'test2')));
  64. dump($f->c_foo('test', array('test1', 'test2')));
Add Comment
Please, Sign In to add comment