A simple PHP Cache library – Pettakam

Hello all, Its been a long time since my last post. Hmm… Time won’t be much better rather than now to introduce my simple PHP cache library – Pettakam

I named it after a tamil word ‘Pettakam’ meaning ‘Treasure Box’. Correct selection of word, indeed!

You can get the library here : https://github.com/vimalsudhan/pettakam

This cache library is effective, if you don’t have memcache or any cache server and you are running large DB queries (with lot of joints) which can be cached. This library makes use of filesytem to cache your variables, which will be faster compared to running queries in a relatively large Database.

Like in a cache server, you can set expiration time for your cached variables, can cache any datatype(numeric,string,arrays,objects) except resource-type, check cached and clear any or all cached.

As a step further for cache control, you can group your cached variables into ‘groups’ and you can clear a set(group) of cached ones. This is useful when there is a ‘UPDATE’ and a set of cached variables are affected & needs updation.

Please read through README at https://github.com/vimalsudhan/pettakam with examples and howto-s.

Its been there for a year and I am using it my codes both personal and professional 🙂 So, its hands down to say it works.

Hoping to publish more of my codes at https://github.com/vimalsudhan. Time will say…!


Vimal Sudhan at Facebook

How to set screen size in mobile/wap site?

If you didn’t know, well its easy as putting your leg in mud clean.
You can set width for your wap site to enclose the whole mobile screen size by using ‘viewport’ meta tag. As you know, meta tags are special instructions sent to browser in our case mobile browser. With many meta tags available, we have another one called ‘viewport’ used to control layout.

Use this tag in head:
<meta name="viewport" content="width=device-width">

“width=device-width” will set width of your site to available width of device screen size. So, now you can use css properties like width:100% to create clean layouts

I hope this helps!