Archive for August, 2009

Improved music site: Cloudspeakers.com

cloudspeakersOne of the CakePHP projects I have is the site named Cloudspeakers.com. In the last three months we improved the website with new features, gave it a complete new layout and did a lot about the usability.
All is build on the latest stable CakePHP core 1.2 and jQuery 1.3

Read full press release here: http://bit.ly/4zUxj2

Removing cache after shell script is done

terminalI have a scraper that runs every 6 hours and adds reviews, audio and video of the found music artists to our database. The problem is that I wanted to cache elements and views for minimum of 1 day and let the scraper remove the cache when it found new items.

Firts of all I use file caching. I tried with Clear::cache(false); at the end of the shell script but that didn’t work. I guess the file list is too long.
The I had a simple bash script that just stated

rm -f tmp/cache/views/element*

But the list was too long and it give ‘Argument too long‘ warnings. Then I had a look on the internet (Wait… what is that?) and created my own long-list-removable-view-files-bash-script:

#! /usr/bin/bash

find ./tmp/cache -name 'cs_*'  | xargs rm -f
find ./tmp/cache -name 'cake_*'  | xargs rm -f
find ./tmp/cache/models -name 'cake_*'  | xargs rm -f
find ./tmp/cache/models -name 'musicbrainz_*'  | xargs rm -f
find ./tmp/cache/persistent -name 'cake_*'  | xargs rm -f
find ./tmp/cache/views -name 'element_*'  | xargs rm -f

It does not only views removal, but I use this script also for new release deployment.
After I had finished this @savant pointed me to the PDF Math Curry where he pointed out the same… Damn!! :)