NoSQL Data Access API: Server Caching Using NoSQL

This API is a PDO counterpart useful for connecting and querying NoSQL document databases with the noted difference it is entirely built in PHP and far better organized.

How does it work?

The way it works is roughly analogous to SQL Data Access API. Because it is entirely built in PHP, it offered me the freedom to create a "right" architecture, which consists in an interplay of:

  1. DataSource: interface all vendors must implement in order to setup data to be used in connection.
  2. Driver: interface identifying basic document database operations all vendors must implement
  3. Server: interface all vendors that require a server must implement in order to setup connection operations.

When an error is encountered, exceptions specific to event are thrown:

  1. ConnectionException: thrown when connection to server fails due to incorrect implementation by developers.
  2. OperationFailedException: thrown when server rejects an otherwise valid operation.
  3. KeyNotFoundException: thrown when a set/delete is performed on a key that doesn't exist.

Almost always we also desire to reuse created connection for other operations throughout user session's duration and also make sure that connection is automatically closed when session ends. For this two classes were added:

  1. ConnectionSingleton: insures a single connection is created, then reused by all operations throughout session's duration, then closed when session ends. This is useful when you're only using one NoSQL server during session's lifetime.
  2. ConnectionFactory: insures a single connection is created for each server, then reused by all operations on that server throughout session's duration, then closed when session ends. This is useful when you're using more than one NoSQL server during session's lifetime.

Just like PDO, API does not support all no-sql vendors on the market. It only supports the ones that are by far the most commonly used:

^ No support is provided for MongoDB, HBase or Cassandra! They are hybrid solutions that merge concepts of SQL and NoSQL and do not work like a normal key-value store.

All classes inside API belong to namespace Lucinda\NoSQL!

How can I use it?

To learn how to install and use this API, follow this step-by-step guide!


Share