PageRenderTime 50ms CodeModel.GetById 27ms RepoModel.GetById 1ms app.codeStats 0ms

/application/modules/cache/controllers/cache.php

https://bitbucket.org/matyhaty/senses-designertravelv3
PHP | 64 lines | 36 code | 21 blank | 7 comment | 3 complexity | 0f5ca1e0604c7784eaf90f0a04e79745 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Cache extends Base_Controller {
  3. function __construct()
  4. {
  5. parent::__construct();
  6. }
  7. /**
  8. * Main function. This should display either a list of grid view of events
  9. *
  10. */
  11. public function index()
  12. {
  13. $this->load->library('session');
  14. $this->load->helper('url');
  15. $this->load->driver('cache');
  16. if($person = $this->cache->file->get('messages_person_1') ){
  17. echo 'Person Now cached<br> ';
  18. }else{
  19. $person = new person(1);
  20. $person->messages_person->get();
  21. $this->cache->file->save('messages_person_1', $person);
  22. }
  23. foreach($person->messages_person as $message)
  24. {
  25. if($myMessages = $this->cache->file->get( 'messages_user_1_message_' . $message->id ) ){
  26. echo 'Message now cached<br> ';
  27. }else{
  28. $message->message->get();
  29. $myMessages = $message;
  30. $this->cache->file->save('messages_user_1_message_' . $message->id , $myMessages);
  31. }
  32. foreach($myMessages->message as $m){
  33. echo $m->message;
  34. }
  35. }
  36. //print_r($person);
  37. die;
  38. $this->template->write_view('content', 'cache/index' , array( ) );
  39. $this->template->render($region = NULL, $buffer = FALSE, $parse = FALSE);
  40. }
  41. }
  42. /* End of file cache.php */
  43. /* Location: ./application/controllers/cache.php */