RSS Feed
^__^

Silex and MongoDB simply

Ivo Bathke, 2012/01/30 16:27

Using MongoDB in your Silex Project is quite easy.

I will show this with my Superleansilexplate and will integrate it there as an example.
Since i dont want to integrate MongoDB in Superleansilexplate it will just become an additional gist.

Given you have some smaller amount of data like a counter that needs to be stored or other loose coupled datasets, we simply speak to MongoDB “directly” and store the data via Doctrine MongoDB Abstraction Layer.
Since i presume the Data / Document Structure isnt that complex we dont use Doctrine MongoDB ODM (the Object Document Mapper).
If you want to use it instead, try this Silex Extensions.

» read more

tell redis db to not persist

Ivo Bathke, 2011/10/27 17:22

redis persists its memory data in snapshot style in every n seconds depending on your configuration.
read more here.
perhaps you would like to use redis as a pure in-memory db, like f.e. memchache.
you can tell redis to not persist and save some bits&miliseconds.
this could be the case when using redis as a f.e. realtime queue, you wont need persistence,
because you could say: nobody needs is newsfeed from the that day before the machine crashed ;)

alright, do so by:
» read more

Migrate to Mongolab

Ivo Bathke, 2011/09/26 07:38

Recently i ran into RAM troubles on my vserver for some reasons, i encountered the evil:

Cannot allocate memory at ...

So first i suspected mongodb to use up loads of memory as top showed.

But after some recherche work i learned mongodb only -seems- to use a lot of memory.
see here and here and here
The actual usage was around 20mb RAM, so mongodb was innocent.

The true RAM monsters were some apache and php-fpm zombies, but thats another story.

While suspecting mongodb i thought about outsourcing the mongodb and i found a free and sufficient offer in mongolab.
My interests were on and i gave it a try.
The free version has a limit for up to 240MB storage and since my app is just a small counter it should last for some time.
» read more

[Symfony 2] Security Bundle – Benutzer mit username oder email anmelden.

Johannes Heinen, 2011/08/12 15:04

Augenscheinlich unterstützt das Security-Module nur die Authentifizierung via Benutzername und Password. Wie man sich mit einem Benutzernamen ODER der E-Mail-Adresse und einem Password authentifiziert, ist ein wenig versteckt. So gehts:

» read more

Grouping & Sorting in MongoDB

Ivo Bathke, 2010/07/24 12:45

Will man mit PHP und MongoDB soetwas wie “SQL Aggregate Functions” umsetzen muss man sich etwas verbiegen.

MongoDb hat zwar eine group() function, die in etwa SQLs GROUP BY entspricht, allerdings kann man dies nicht kombinieren mit SORT oder LIMIT bzw den sort() und limit() Funktionen, da diese keinen Cursor zurückgibt sondern direkt ein Array.

Will man also sortieren und limitieren muss man sich des Map / Reduce features von MongoDB bedienen.

» read more

Cheat-Sheets für alle(s)

Johannes Heinen, 2010/06/13 15:26

Diesem Mann ist sicher nie langweilig: http://www.addedbytes.com/cheat-sheets/. Hinter diesem Link verbergen sich Cheat Sheets zum Selber-Ausdrucken für alles Denkbare.

mongomongomongomongo

Max Girkens, 2010/06/04 23:27

Man wird möglicherweise ein bisschen nervös, aber auch schlauer:
http://www.parleys.com/#st=5&sl=4&id=1864

Und Doctrine macht auch in Sachen Mongo, hab ich gerade gesehen.
http://www.doctrine-project.org/projects/mongodb_odm
» read more