redis2 Redis LUA Script print("Hello Lua World!")local value = 10 + 1print(value)if value > 0 then print ('value is positive')end if value ~= 0 then print("value is non zero")endif value == 11 then print("value is 11")endlocal country = {"south korea", "UC","north"}print(#country)table.insert(country,"ckck")print(country[4])for i,v in ipairs(country) do print(i,v)end for i =1, 5 do print(i)endlocal car.. 2024. 6. 24. Redis를 활용한 레이스 컨디션 개선. 레이스 컨디션이란? 멀티쓰레드 환경에서 공유자원을 경합하며 벌어지는 동기화 문제가 발생한 현상. 레디스의 INCR 활용한 간단한 해결방안 INCR은 Redis에서 제공하는 명령 중 하나로, "increment"의 약어이다. 이 명령은 키에 저장된 값이 정수일 경우에만 사용할 수 있다. 키에 저장된 값을 1씩 증가시킨다. SET mykey 10 INCR mykey 위 예제에서 mykey의 초기 값은 10으로 세팅했다. INCR mykey를 실행하면 mykey의 값이 1이 증가하여 11이 된다. 이 명령은 분산 환경에서도 안전하게 사용할 수 있어서, 여러 클라이언트가 동시에 INCR을 실행해도 서로 간섭 없이 값이 증가한다 코드를 통해 알아보자 @Repository public class RedisRepos.. 2023. 11. 30. 이전 1 다음