design - PHP with Spl DataStructures as replacement for multi-dimensional array -


i've seen many questions on topic, none of them covers case.

i building acl module based on 5 classes:

  1. role
  2. privilege
  3. group
  4. wrapper(guess does..)factory privilege, role , group classes
  5. accesslist store groups/roles (based on usage , case)

i thinking use splqueue store privileges levels(mainly inherited privileges) thinking use single object store , not think normal multi-dimensional array best choice. flow this paste, tl;dr.. sorry that.

so question splqueue overkill in case?

should use , alternative spl data structure, , if one?

edit couldn't think of example of usage, lets keep unix based gbac.

if want store data in object form use splobjectstorage. splqueue overkill small array.

splqueue works on fifo.

so cann't access directly last or near last , take time.

instead of splqueue suggest use array can access element directly array index.

you can check answer of question: associative array versus splobjectstorage

also can check the performance of splobjectstorage , array, here code.

for more read here.

splobjectstorage scaled linearly. array performance less predictable (larger standard deviation) smaller data sets. , splobjectstorage indeed better solution storing lots of objects in set.

so if data small should use array otherwise use splobjectstorage large amount of data.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -