Skip to content

yuokada/jvm-memcached-tool

Repository files navigation

jvm-memcached-tool

Maven Central Maven Central Last Update javadoc

This is a practice project to learn how to use Quarkus, the Supersonic Subatomic Java Framework, with Picocli.

original: scripts/memcached-tool

Prerequisite

  • JDK 17

Build

$ ./mvnw clean package

# the below jar is an executable jar. Please rename it if necessary.
$ ls target/memcached-tool.jar
target/memcached-tool.jar

Run

$ java -jar target/memcached-tool.jar
Usage: memcached-tool [-hvV] [--host=<configEndpoint>] [-p=<clusterPort>]
                      [COMMAND]
Simple tool to handle memcached
  -h, --help
      --host=<configEndpoint>
                             Cluster hostname.
                               Default: localhost
  -p, --port=<clusterPort>   Cluster port number.
                               Default: 11211
  -v, --verbose              Enable verbose mode.
  -V, --version              print version information and exit
Commands:
  display        Display slab statistics
  generate, gen  Generate items on memcached!
  dump
  keys
  stats          Perform stats command. Pass an optional extra argument
                   (items/settings/sizes)
  sizes          Display item size histogram
  flush          Flush items on memcached

Subcommands

Command Description Options
display Display slab class statistics -j, --json — output as JSON
generate, gen Write random items to memcached -s, --size — item size in bytes (0 = random); -j, --json — output as JSON
dump Dump all item key-value pairs -l, --limit — max keys to dump (0 = no limit)
keys Dump all keys -l, --limit — max keys to dump (0 = no limit)
stats [extra] Run stats command; optional scope: items, settings, sizes -j, --json — output as JSON
sizes Display item size histogram -j, --json — output as JSON
flush Flush (delete) all items on the server

Development

Run Memcached with Docker

To spin up a local Memcached instance quickly, start the official Docker image:

$ docker run -d --rm --name memcached \
    -p 11211:11211 \
    memcached:1.6.32-alpine

# Verify the instance via the stats command
$ java -jar target/memcached-tool.jar stats --host localhost --port 11211

📦 Releasing jvm-memcached-tool to Maven Central

This document describes how to release this library to Maven Central using maven-release-plugin and central-publishing-maven-plugin.


✅ Prerequisites

  • You must have a Sonatype Central Portal account.
  • Your project must be registered and approved via OSSRH (JIRA).
  • Your ~/.m2/settings.xml must contain the following credentials:
<servers>
  <server>
    <id>central</id>
    <username>your-token-username</username>
    <password>your-token-password</password>
  </server>
</servers>
$ mvn -Prelease release:prepare
$ mvn -Prelease release:perform

(If necessary) When the release commands are failed

mvn release:clean
git reset --hard
git clean -fd
git tag -d <TAG: 0.2.1>

References

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Contributors