Skip to content

Commit

Permalink
style(*) cosmetic updates and identation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultcha committed Apr 29, 2017
1 parent c706d89 commit aefe92a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions lib/resty/mlcache.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ local LOCK_KEY_PREFIX = "lock:"
local CACHE_MISS_SENTINEL_LRU = {}


local type_lookup = {
number = 1,
boolean = 2,
string = 3,
table = 4,
local TYPES_LOOKUP = {
number = 1,
boolean = 2,
string = 3,
table = 4,
}


Expand Down Expand Up @@ -79,15 +79,15 @@ do
return tostring(number)
end,

[2] = function(bool) -- boolean
[2] = function(bool) -- boolean
return bool and "true" or "false"
end,

[3] = function(str) -- string
[3] = function(str) -- string
return str
end,

[4] = function(t) -- table
[4] = function(t) -- table
local json, err = cjson.encode(t)
if not json then
return nil, "could not encode table value: " .. err
Expand Down Expand Up @@ -253,7 +253,7 @@ local function shmlru_set(self, key, value, ttl, neg_ttl)

-- serialize insertion time + Lua types for shm storage

local value_type = type_lookup[type(value)]
local value_type = TYPES_LOOKUP[type(value)]

if not marshallers[value_type] then
return error("cannot cache value of type " .. type(value))
Expand Down
16 changes: 8 additions & 8 deletions lib/resty/mlcache/ipc.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ local INDEX_KEY = "index"


ffi.cdef [[
struct event {
unsigned int at;
unsigned int pid;
unsigned int data_len;
unsigned int channel_len;
unsigned char *channel;
unsigned char *data;
};
struct event {
unsigned int at;
unsigned int pid;
unsigned int data_len;
unsigned int channel_len;
unsigned char *channel;
unsigned char *data;
};
]]


Expand Down

0 comments on commit aefe92a

Please sign in to comment.