Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

touch 기능 개발 #487

Open
minkikim89 opened this issue Aug 5, 2020 · 5 comments
Open

touch 기능 개발 #487

minkikim89 opened this issue Aug 5, 2020 · 5 comments
Assignees

Comments

@minkikim89
Copy link
Contributor

memcached 프로젝트에는 지정한 키에 대해 expire time을 재설정하는 touch 기능이 존재한다.
이를 ARCUS에도 개발하도록 한다.
만약 키가 존재하지 않는다면 NOT_FOUND를 반환한다.

@DubleDstudy
Copy link

이슈 제가 맡아 진행 하겠습니다.

@namsic
Copy link
Collaborator

namsic commented Jul 4, 2024

  • memcached에서는 touch, gat명령을 제공
  • redis에서는 TOUCH, EXPIRE 명령을 제공 (다른 명령도 있는지?)

기본적으로 memcached protocol과 호환을 위해서 touchgat 명령이 제공되어야 할 것입니다.
redis에서 gat에 대응되는 명령을 제공하는지를 먼저 확인해야 할 것 같습니다.

@cheesecrust redis에서 특정 item에 대한 expire time을 조작하는 명령으로 어떤 명령을 제공하고 있는지 확인하고 알려주면 좋겠습니다.

@cheesecrust
Copy link

memcached 에서의 touch, gat

  • touch: 주어진 key 에 대해서 item 을 fetch 하지 않고 expire time 만을 재설정 합니다.
  • gat: touch 와 하는 일은 같지만, item 을 fetch 하여 가져옵니다.

redis 에서의 대응되는 명령

  • 우선 redis 에도 touch 명령어가 있지만, redis 의 touch 는 key 의 last access time 을 바꾸는 것으로 redis 의 LRU 정책과 관련이 있어 보입니다.

  • 현재 redis 에서는 expire time 과 관련해서 제공하는 명령은 EXPIRE, PEXPIRE 을 제공합니다.

    • EXPIRE: key 의 expire 값을 재설정 합니다. 단위는 second 입니다.
    • PEXPIRE: key 의 expire 값을 재설정 하는데, 이때의 단위가 millisecond 입니다.

하지만 redis 의 만료시간은 key 마다 설정되기 때문에 일반 KV 타입은 모두 EXPIRE 명령어로 설정 할 수 있지만, Collection 타입에 있어서는 collection 자체는 키에 대응 되기 때문에 리스트나 맵에 대해서는 만료시간을 설정 할 수 있지만 그 안의 item에 대해서는 설정할 수 없습니다.

정리하자면 redis 에는 key 의 expire time 을 재설정 하는 EXPIRE 명령이 존재하지만, redis 의 ttl 은 item 이 아닌 key 에 부여되기 때문에 KV 관계와 collection 타입일 경우 전체 collection 자체 (item 들을 담는 리스트나 맵을 뜻합니다.) 에 이 명령을 사용하여 ttl 을 조절합니다.

@namsic
Copy link
Collaborator

namsic commented Jul 4, 2024

하지만 redis 의 만료시간은 key 마다 설정되기 때문에 일반 KV 타입은 모두 EXPIRE 명령어로 설정 할 수 있지만, Collection 타입에 있어서는 collection 자체는 키에 대응 되기 때문에 리스트나 맵에 대해서는 만료시간을 설정 할 수 있지만 그 안의 item에 대해서는 설정할 수 없습니다.

  • cache item: 하나의 key에 대응
  • element: collection type의 item에서, 각 item에 속한 하위 원소들

위 용어 기준으로, arcus도 item(key) 단위로 expire time이 설정되고, 개별 element 수준에서 만료 시간을 설정할 수는 없습니다.

expire time 재설정

  • redis에서는 EXPIRE명령으로 제공 (redis의 TOUCH는 memcached의 touch와 다른 명령)
  • item type과 무관하게 touch <key> <exptime>\r\n으로 제공 가능할 것

데이터 조회하면서 expire time 재설정

  • redis에서는 제공하지 않는듯 함
  • collection type에서 조회와 touch를 함께 수행하는 연산을 제공하려면 새로운 인터페이스 설계가 필요

cheesecrust added a commit to cheesecrust/arcus-memcached that referenced this issue Jul 5, 2024
cheesecrust added a commit to cheesecrust/arcus-memcached that referenced this issue Jul 5, 2024
alter expire time without fetch item
cheesecrust added a commit to cheesecrust/arcus-memcached that referenced this issue Jul 5, 2024
fix touched success string "OK" to "TOUCHED"
cheesecrust added a commit to cheesecrust/arcus-memcached that referenced this issue Jul 5, 2024
fix expire time to realtime
@namsic
Copy link
Collaborator

namsic commented Jul 12, 2024

@cheesecrust gat 명령도 추가해 주면 좋겠습니다.

cheesecrust added a commit to cheesecrust/arcus-memcached that referenced this issue Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants