Welcome Guest, Not a member yet? Register   Sign In
Controlling cache
#11

[eluser]John_Betong_002[/eluser]
@ChrisMiller

I have just read this interesting article again and still convinced an easy solution is not available to all.

http://stevenbenner.com/2010/12/caching-...rformance/

If the @IconFinder wants his searches to be cached, is having trouble with the $_GET parameters then he/she should investigate extracting the $_POST variable and building a URL.

Code:
// user search_string = 'this is a test to see if it works';
  // should clean results to eliminate ".,:l/\@", etc
  $tmp = str_replace(' ', '/', $_POST['users_search_string']);
  
  $url   = 'controller/method/' .$tmp;
  //$url = 'controller/method/this/is/a/test/to/see/if/it/works';

  redirect($url);
  
  // Controller function method() results shown with $this->uri->uri_string, or $this->uri->segment(1);

 
 
 
#12

[eluser]Unknown[/eluser]
Why aren't you just using the uri functions and specifying site.com/search/q/cat or doing remapping and using simply site.com/search/dog

I would imagine these would cache just fine without some massive headache as my opinion is that the cache class was probably designed to ignore anything after an equal sign....

Reference:
http://ellislab.com/codeigniter/user-gui...s/uri.html
http://ellislab.com/codeigniter/user-gui...uting.html
#13

[eluser]Iconfinder[/eluser]
[quote author="wh1tel1te" date="1302060385"]Search result pages shouldn't be cached.[/quote]

What are you talking about? In a week 90% of the searches have been done at least once before. There's a huge benefit of caching these results.
#14

[eluser]Iconfinder[/eluser]
[quote author="xds" date="1302078514"]Why aren't you just using the uri functions and specifying site.com/search/q/cat or doing remapping and using simply site.com/search/dog[/quote]

I would prefer to use HTML as intended with a form on the home page which uses GET and use URL parameters to the generate search results.
#15

[eluser]wh1tel1te[/eluser]
[quote author="Iconfinder" date="1302356130"][quote author="wh1tel1te" date="1302060385"]Search result pages shouldn't be cached.[/quote]

What are you talking about? In a week 90% of the searches have been done at least once before. There's a huge benefit of caching these results.[/quote]

I'm talking about caching the whole page, because you would then get those results every time for any other keywords.
#16

[eluser]Iconfinder[/eluser]
[quote author="wh1tel1te" date="1302356227"]I'm talking about caching the whole page, because you would then get those results every time for any other keywords.[/quote]

Even if only a part of the page is cached, it shouldn't search the database the second time a search term is used. I think there should be a way to use URI parameters as a part of the unique key for writing and retrieving cached pages. I don't understand why /search/dog is be supported but not /search/?q=dog
#17

[eluser]wh1tel1te[/eluser]
[quote author="Iconfinder" date="1302356553"][quote author="wh1tel1te" date="1302356227"]I'm talking about caching the whole page, because you would then get those results every time for any other keywords.[/quote]

Even if only a part of the page is cached, it shouldn't search the database the second time a search term is used. I think there should be a way to use URI parameters as a part of the unique key for writing and retrieving cached pages. I don't understand why /search/dog is be supported but not /search/?q=dog[/quote]
Unfortunately CI doesn't do that sort of thing out of the box. You'd have to either extend/hack around the cache library, or build your own caching system.

These forums seem to cache search results for a little while, maybe someone with access to the Expression Engine forums software could have a look at the code for it.




Theme © iAndrew 2016 - Forum software by © MyBB