Welcome Guest, Not a member yet? Register   Sign In
Caching and content
#1

[eluser]innocast[/eluser]
Hello,

I've just started out developing my site in CI. Since it will be a pretty heavy and well visited site I really need to use caching.

The problem is that most of the content of the page can be static and cached, but not all of it. A login box for example should not be cached, and it's a part of every page. If logged in, show AAA, else show BBB.

I was thinking about using variables like {memory_usage} and {elapsed_time} to do the dynamic content. But the question is, what kind of code do I create for this? Plugin? Library? A hook? What's the best to do?

Thanks for reply,

Robert
#2

[eluser]Colin Williams[/eluser]
You can't do full page caching in your case. Look into database caching (already provided by CI) and partial caching (scour the Wiki and Forums for that topic; I'm no expert).

With partial caching, the areas of your pages that are less dynamic won't require as many, or any, calls to the database. But in turn, you get more file system calls (same is true with database caching).

Full page caching is the most efficient, but very limiting on dynamic sites.

Also look into server-side options like Memcache, Squid, et al. Just Google it all
#3

[eluser]innocast[/eluser]
Hi!

Thanks for a fast reply, this is why I love Codeigniter.

Anyway, was looking through the wiki and found something called "Sparks" ( http://codeigniter.com/wiki/Sparks/ ). Will give it a try and probably modify it a bit to fit my needs!

Thanks,

Robert
#4

[eluser]innocast[/eluser]
OK, Sparks was an epic failure :-)

Will develop my own addon for CI and publish it here when I'm done!
#5

[eluser]Dam1an[/eluser]
[quote author="innocast" date="1243771762"]OK, Sparks was an epic failure :-)[/quote]

When you say Spaks was an epic failure, is that just in your case, or the library just doesn't work?
Caching is something I may need to look into soon'ish and it's a little more more complex then standard dynamic caching in my case Sad
#6

[eluser]innocast[/eluser]
Hi Dam1an!

First of all, the library didnt work when first installed. Second of all, when looking through the code, documentation and comments I realised this wasn't optimized for my solution. I'm builing a social network and it's very important that the code is switft and optimized, no bottle necks can be accepted.

The idea is great and probably the code too for a small application. It just didn't meet my requirements Smile

// R

[quote author="Dam1an" date="1243779113"][quote author="innocast" date="1243771762"]OK, Sparks was an epic failure :-)[/quote]

When you say Spaks was an epic failure, is that just in your case, or the library just doesn't work?
Caching is something I may need to look into soon'ish and it's a little more more complex then standard dynamic caching in my case Sad[/quote]
#7

[eluser]Jondolar[/eluser]
How many cached pages do you expect to have?

I'm working on a project that needs a custom cache also. I'm using multiple subdirectories to make finding the correct file more efficient. If you plan on caching files in the millions, you might want to ensure your project supports storing cache files in sub/sub directories.

Good luck with your project.
#8

[eluser]innocast[/eluser]
Yepp, well aware of that :-) Had a "rapidshare" (legal) site before that was using symlinks. When they reached over 15.000 symlinks (expired after 15 minutes with the help of a cronjob) the IO was slowing the system down brutally.

Hopefully this library/hook (or whatever it will be) can be a part of the community!

By the way, the variables set in the templates like {memory_usage} and {parsing_time}, how are they set? I guess that would be a pretty easy thing to use for DYNAMIC content.

Had a look at Zend Framework yesterday, but it was way to complex to use... Even for my big application. So I will stick with CodeIgniter and support it!
#9

[eluser]madeks[/eluser]
Hi,

I thought you already have your way to go.

Here are some of my experience.
I once worked for a company that combine 4 cache methods in there website,
memcache, DB cache, html cache, hashing file cache.
They use them for a specific purpose and maximize it benefit.


For my own sake I just modify the CI cahce to be able to config which controller,
action or view I want or don't want to cache.
It can help me from 0.3 to 0.02 sec.


Hope that help. Smile
#10

[eluser]innocast[/eluser]
He he, well I do :-) But I don't have knowledge on how to fully use CI... Yet :-)




Theme © iAndrew 2016 - Forum software by © MyBB