News Feed
Sections




News Archive
feed this:

Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

ServerGrove.com:
MongoDB TTL collections
August 26, 2013 @ 09:30:47

On the ServerGrove blog today there's a new post talking about TTL collections in MongoDB - queries with a time-to-live set on the indexes - and includes how to use them in PHP.

MongoDB (v. 2.2+) provides a mechanism to expire data from collections by setting a TTL -time to live- on indexes. This is a great feature if you have data that needs to persist in the database for a specific period of time. The TTL feature allows you to expire data using the MongoDB daemon instead of having to create cron jobs to delete expired data. [...] The MongoDB daemon (mongod) checks regularly for documents in collections with a TTL and removes the expired documents.

Using it from PHP is relatively simple - all that's needed is a configuration parameter on the "ensureIndex" call setting an "expireAfterSeconds" value. There's also a bit included in the post for the Doctrine users out there, showing the docblock comment to use to set the value.

0 comments voice your opinion now!
mongodb ttl timetolive collections expire seconds tutorial

Link: http://blog.servergrove.com/2013/08/23/mongodb-ttl-collections/

SmartyCode.com:
Enable your Zend Framework App with Conditional GET! (Make it green)
March 26, 2009 @ 14:25:59

On the SmartyCode.com site there's a quick new post about making your Zend Framework site a bit more "green" with a conditional GET feature.

In this article I'll show you a simple approach to enable your Zend Framework application saving lots of precious bandwidth, and thus, making it more end-users friendly, and save on bandwidth costs. This technique involves HTTP conditional GET. This is basically a feature of the HTTP protocol. By sending correct HTTP headers with your application, you enable browsers of your end users to cache pages of your site.

A plugin for the front controller (with a dispatchLoopShutdown method inside) is used to handle the requests and cache their content correctly. They have the cache set at 7200 seconds (2 hours) for a time to live, but its easy to tweak it based on your application. TO use the plugin call the registerPlugin function on the controller object and add it as the very last thing that runs.

0 comments voice your opinion now!
conditional get cache timetolive zendframework dispatchloopshutdown


Brian Moon's Blog:
PHP session cookie refresh
May 14, 2008 @ 12:51:02

Brian Moon has posted a tip (and a bit of code) he's worked up to help make a users cookies last a bit longer than they were originally designed to:

When you start a session, if the user had no cookie, they get a new session id and they get a cookie. You can configure that cookie to last for n seconds via php.ini or session_cookie_set_params(). But, and this is a HUGE but for me, that cookie will expire in n seconds no matter what.

His method provides a way to extend the life of the cookies currently set for the domain by changing the time to live through a series of ini_get calls wrapped in a setcookie() call.

0 comments voice your opinion now!
cookie session refesh timetolive setcookie iniset



Community Events





Don't see your event here?
Let us know!


version release composer introduction symfony podcast library conference language security community artisanfiles list interview opinion voicesoftheelephpant series tool framework laravel

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework