View Source SuperCache.Stack (SuperCache v0.6.1)

Stack module helps to easy to use stack data structure. This is global stack, any process can access to stack data. Can handle multiple stack with different name. Need to start SuperCache.start!/1 before using this module.

Ex:

alias SuperCache.Stack
SuperCache.start!()
Stack.push("my_stack", "Hello")
Stack.pop("my_stack")
  # => "Hello"

Summary

Functions

Pop value from stack with name is stack_name. If stack_name is not existed or no data, it will return default value.

Add value to stack has name is stack_name. If stack_name is not existed, it will be created.

Functions

count(stack_name)

get_all(stack_name)

pop(stack_name, default \\ nil)

@spec pop(any(), any()) :: any()

Pop value from stack with name is stack_name. If stack_name is not existed or no data, it will return default value.

push(stack_name, value)

@spec push(any(), any()) :: true

Add value to stack has name is stack_name. If stack_name is not existed, it will be created.