SAM MORRELL


ASTROPHYSICIST

Dahl – Progress Update 1

July 24, 2011   |   Reading time: ~3 mins

Hello all, if you follow me on twitter, @smorrell if anyone is interested, you may have noticed I haven’t half been prattling on lately with a load of mumbo jumbo. These are my little snippets of code so here’s some context to my programming jargon fuelled tweets. Time for a little progress report on Dahl, which I introduced a couple posts ago. I won’t bore you with another introduction, you can read the other post for all that. Here’s what I’ve been working on.

Caching

The main focus of my work over the past couple days has been working on Dahl’s caching capabilities. I’ve managed to get it very ably fetching from databases, but how could I improve performance and reliability?

So, I implemented a nice little time based cache. I had to invent some extra objects and properties to make it all work out but alas it’s working rather nicely now. Only a few hours work too. It’s given performance a nice little boost too. With the data cached I saw performance that was averaging about twice as fast, even when I was executing 9 table fetches it still showed this trend. I’m happy with that, there’s always time for tweaking and performance improvements later on eh?

Offline Mode

It occurred to me today that I’m storing all this data locally to avoid some performance issues, so there must be something else I could do to leverage this. So I decided to allow Dahl to run disconnected from the datasource. Dahl will run off of the cached data if it is unable to establish a connection to the server, it will run off of that until it is able to reestablish a connection, at that point it refreshes the cache from the data source. I thought it was quite a good idea, though I might well add some kind of flag within the configuration file to allow it to be disabled.

Dataset Tweaking

Probably the most important object within Dahl is the Dataset object, this deals with all the data manipulation and storage while active within PHP. Today I’ve been tweaking how it behaves when treated like an array. Before, I had implemented the arrayaccess interface to allow it to be accessed like an array, but today I decided to also implement the Iterator and Countable interfaces to permit the count() function to be used and also to permit foreach statements and the like. So far it seems to be working fine but I think I shall keep tweaking it for a while yet before I’m happy with it.

I hope you enjoyed this little roundup of my recent activities. I’ll be sure to post another update soon. Thanks for reading.

Tags:

You Might Also Like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Comments

Sorry, there are currently no comments for this artcle. Why not start a conversation?